/* ═══════════════════════════════════════════════════════════════════════════
   Study-Forge — app.css  v2  (sidebar layout + auth + modern redesign)
═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --primary:        #10B981;
  --primary-hover:  #059669;
  --primary-light:  #ECFDF5;
  --primary-text:   #065F46;
  --accent:         #3B82F6;
  --accent-light:   #EFF6FF;
  --success:        #22C55E;
  --success-light:  #DCFCE7;
  --success-text:   #15803D;
  --error:          #EF4444;
  --error-light:    #FEE2E2;
  --error-text:     #B91C1C;
  --warning:        #F59E0B;
  --warning-light:  #FEF3C7;
  --warning-text:   #92400E;

  --bg:             #F1F5F9;
  --bg-card:        #FFFFFF;
  --bg-card-hover:  #F8FAFC;
  --text:           #0F172A;
  --text-muted:     #4B5563;
  --text-light:     #64748B;
  --border:         #E2E8F0;
  --border-focus:   #6EE7B7;

  --sidebar-bg:     #0F172A;
  --sidebar-text:   #CBD5E1;
  --sidebar-active: #10B981;
  --sidebar-w:      256px;

  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 28px rgba(0,0,0,.09), 0 4px 8px rgba(0,0,0,.05);
  --shadow-xl:  0 20px 48px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.07);

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --mh:         60px;
  --bn-h:       64px;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --t:          150ms ease;
}

/* ── Dark Theme ──────────────────────────────────────────────────────────── */
.dark {
  --primary-light:  #022c22;
  --primary-text:   #6EE7B7;
  --accent-light:   #1e3a5f;
  --success-light:  #052e16;
  --success-text:   #4ADE80;
  --error-light:    #450a0a;
  --error-text:     #FCA5A5;
  --warning-light:  #451a03;
  --warning-text:   #FCD34D;

  --bg:             #0F172A;
  --bg-card:        #1E293B;
  --bg-card-hover:  #263348;
  --text:           #F1F5F9;
  --text-muted:     #94A3B8;
  --text-light:     #64748B;
  --border:         #334155;
  --border-focus:   #34D399;

  --sidebar-bg:     #020617;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,.5);
  --shadow-lg:  0 10px 32px rgba(0,0,0,.6);
  --shadow-xl:  0 20px 48px rgba(0,0,0,.7);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
ul { list-style: none; }
img { max-width: 100%; }
input, textarea, select {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  width: 100%;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

/* ── Loading Screen ─────────────────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0F172A 0%, #134E4A 100%);
}
.loader-content { text-align: center; color: #fff; }
.loader-logo {
  width: 96px; height: 96px; object-fit: contain;
  background: rgba(255,255,255,.97);
  border-radius: 22px;
  padding: 10px;
  margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 0 0 2px rgba(16,185,129,.4);
}
.loader-progress-wrap {
  width: 200px; height: 4px; background: rgba(255,255,255,.25);
  border-radius: 99px; overflow: hidden; margin: 0 auto 16px;
}
.loader-progress-bar {
  height: 100%; background: #fff; border-radius: 99px;
  width: 0; transition: width .4s ease;
}
.loader-hint { font-size: 14px; opacity: .8; }

/* ══════════════════════════════════════════════════════════════════════════
   AUTH OVERLAY
═══════════════════════════════════════════════════════════════════════════ */
#auth-overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.auth-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #0F172A 0%, #134E4A 60%, #065F46 100%);
}
.auth-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-card {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-xl);
  animation: auth-in .3s ease;
}
@keyframes auth-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.auth-logo {
  text-align: center; margin-bottom: 12px;
}
.auth-logo img {
  width: 68px; height: 68px; object-fit: contain; border-radius: var(--radius);
  background: #fff; padding: 9px;
}
.auth-title {
  text-align: center; font-size: 24px; font-weight: 800;
  letter-spacing: -.5px; margin-bottom: 4px;
}
.auth-sub {
  text-align: center; color: var(--text-muted); font-size: 14px;
  margin-bottom: 24px; line-height: 1.5;
}
.auth-tabs {
  display: flex; background: var(--bg); border-radius: var(--radius-sm);
  padding: 4px; gap: 4px; margin-bottom: 20px;
}
.auth-tab {
  flex: 1; padding: 8px; border-radius: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: all var(--t);
}
.auth-tab.active {
  background: var(--bg-card); color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-hint { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.auth-error {
  font-size: 13px; color: var(--error-text);
  background: var(--error-light); border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text-light); font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 20px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1.5px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: all var(--t); cursor: pointer;
}
.btn-google:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.btn-guest { display: none; }
.remember-row {
  margin: 4px 0 10px;
}
.remember-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); cursor: pointer; user-select: none;
}
.remember-label input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer;
}
.auth-legal {
  text-align: center; font-size: 13px; color: var(--text-muted);
  margin-top: 14px; line-height: 1.5;
}
.auth-legal a { color: var(--primary); }

/* Guest banner */
#guest-banner {
  background: var(--warning-light);
  border-bottom: 1px solid rgba(245,158,11,.3);
  padding: 8px 20px;
  font-size: 13px; color: var(--warning-text);
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
#guest-banner button {
  font-size: 13px; font-weight: 600; color: var(--primary);
  padding: 2px 8px; border-radius: var(--radius-sm);
}
#guest-banner button:hover { background: var(--primary-light); }

/* ══════════════════════════════════════════════════════════════════════════
   FACHRICHTUNG SELECTION
═══════════════════════════════════════════════════════════════════════════ */
#fachrichtung-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
}
.fr-card {
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 40px 32px; max-width: 480px; width: 100%;
  box-shadow: var(--shadow-xl); text-align: center;
  animation: auth-in .3s ease;
}
.fr-logo { width: 76px; height: 76px; object-fit: contain; border-radius: var(--radius-lg); background: var(--primary-light); padding: 10px; border: 2px solid rgba(16,185,129,.2); margin-bottom: 16px; }
.fr-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.fr-sub { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 28px; }
.fr-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.fr-option {
  padding: 28px 16px; border-radius: var(--radius-lg);
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; transition: all .2s ease; text-align: center;
}
.fr-option:hover {
  border-color: var(--primary); background: var(--primary-light);
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.fr-option-icon { font-size: 36px; margin-bottom: 10px; }
.fr-option-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.fr-option-desc { font-size: 12px; color: var(--text-muted); }
.fr-hint { font-size: 13px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform .25s ease, background var(--t), border-color var(--t);
  overflow-y: auto;
  /* hidden on mobile by default */
  transform: translateX(-100%);
}
.sidebar.open { transform: translateX(0); }
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.sidebar-header {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 20px;
  height: 80px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo { height: 40px; width: 150px; object-fit: cover; object-position: center; background: none; padding: 0; box-shadow: none; display: block; }
.sidebar-close-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #94A3B8; transition: background var(--t);
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.1); }

.sidebar-nav {
  flex: 1; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.sn-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: #94A3B8;
  transition: all var(--t); white-space: nowrap;
  position: relative;
}
.sn-item svg { flex-shrink: 0; transition: stroke var(--t); stroke: #64748B; }
.sn-item:hover { background: rgba(255,255,255,.07); color: #F1F5F9; }
.sn-item:hover svg { stroke: #CBD5E1; }
.sn-item.active {
  background: rgba(16,185,129,.15);
  color: #10B981;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #10B981;
}
.sn-item.active svg { stroke: #10B981; }
.sn-item-btn { width: 100%; }
.sn-spacer { flex: 1; min-height: 12px; }

.sidebar-footer {
  padding: 10px 10px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
}
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(16,185,129,.2); color: #10B981;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600; color: #F1F5F9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-sub {
  font-size: 11px; color: #64748B; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-more-btn {
  width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #64748B; transition: background var(--t);
}
.sidebar-more-btn:hover { background: rgba(255,255,255,.1); }

.user-menu {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  overflow: hidden; margin: 0 2px;
}
.um-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  font-size: 13px; font-weight: 500; color: var(--text);
  transition: background var(--t);
  text-decoration: none;
}
.um-item:hover { background: var(--border); }
.um-danger { color: var(--error-text); }
.um-danger:hover { background: var(--error-light); }

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE HEADER
═══════════════════════════════════════════════════════════════════════════ */
.mobile-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--mh);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  transition: background var(--t);
}
.dark .mobile-header { background: rgba(30,41,59,.9); }
.mh-hamburger {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: background var(--t);
  flex-shrink: 0;
}
.mh-hamburger:hover { background: var(--border); }
.mh-brand {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 800; color: var(--text);
}
.mh-brand img { width: 48px; height: 48px; object-fit: contain; border-radius: 0; background: none; padding: 0; }
.mh-brand { font-size: 15px; font-weight: 800; color: var(--text); gap: 8px; flex: 1; display: flex; align-items: center; }
.mh-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--border); color: var(--text); }

/* ══════════════════════════════════════════════════════════════════════════
   BOTTOM NAV (Mobile)
═══════════════════════════════════════════════════════════════════════════ */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bn-h);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background var(--t), border-color var(--t);
}
.bn-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  padding: 8px 4px; border-radius: var(--radius-sm);
  transition: color var(--t); position: relative;
}
.bn-item svg { transition: stroke var(--t); }
.bn-item.active { color: var(--primary); }
.bn-item.active svg { stroke: var(--primary); }
.bn-item.active::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2px; background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* ══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT LAYOUT
═══════════════════════════════════════════════════════════════════════════ */
#main-content {
  padding-top: calc(var(--mh) + 16px);
  padding-bottom: calc(var(--bn-h) + 20px);
  min-height: 100vh;
  transition: padding var(--t);
}
.page {
  max-width: 860px; margin: 0 auto; padding: 0 16px 40px;
}
.page-wide {
  max-width: 1100px; margin: 0 auto; padding: 0 16px 40px;
}
.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2;
}
.page-header p {
  margin-top: 6px; color: var(--text-muted); font-size: 15px; line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: background var(--t), border-color var(--t);
}
.card-hover {
  transition: transform .2s ease, box-shadow .2s ease,
              background var(--t), border-color var(--t);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transition: background var(--t), transform .1s, box-shadow .1s;
  white-space: nowrap; cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(79,70,229,.4);
}
.btn-secondary {
  background: var(--bg-card); color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-ghost { color: var(--text-muted); padding: 8px 14px; }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16A34A; }
.btn-danger  { background: var(--error);   color: #fff; }
.btn-danger:hover  { background: #DC2626; }
.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; border-radius: var(--radius); }
.btn-full { width: 100%; }

/* ══════════════════════════════════════════════════════════════════════════
   CHIPS / BADGES
═══════════════════════════════════════════════════════════════════════════ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 13px; font-weight: 600; border: none;
  transition: opacity .15s;
}
.chip:hover { opacity: .85; }
.chip-primary { background: var(--primary-light); color: var(--primary-text); }
.chip-success { background: var(--success-light); color: var(--success-text); }
.chip-error   { background: var(--error-light);   color: var(--error-text); }
.chip-muted   { background: var(--border);        color: var(--text-muted); }
.chip-accent  { background: var(--accent-light);  color: #1D4ED8; }
.dark .chip-accent { color: #93C5FD; }

/* ══════════════════════════════════════════════════════════════════════════
   PROGRESS BAR
═══════════════════════════════════════════════════════════════════════════ */
.progress-wrap {
  height: 8px; background: var(--border);
  border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: var(--primary); transition: width .4s ease;
}
.progress-fill.green  { background: var(--success); }
.progress-fill.orange { background: var(--warning); }
.progress-thin  { height: 4px; }
.progress-thick { height: 10px; }

/* ══════════════════════════════════════════════════════════════════════════
   HOME VIEW
═══════════════════════════════════════════════════════════════════════════ */
.home-hero {
  background: linear-gradient(135deg, #0F172A 0%, #134E4A 60%, #065F46 100%);
  border-radius: var(--radius-lg); padding: 32px 28px;
  color: #fff; margin-bottom: 28px;
  box-shadow: 0 8px 28px rgba(16,185,129,.2);
  position: relative; overflow: hidden;
}
.home-hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.07'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.home-hero-inner { position: relative; z-index: 1; }
.home-hero-greeting {
  font-size: 24px; font-weight: 800; margin-bottom: 6px; line-height: 1.2;
}
.home-hero-sub { font-size: 15px; opacity: .85; margin-bottom: 20px; line-height: 1.5; }
.home-hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.home-hero-chip {
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  padding: 5px 14px; border-radius: 99px;
  font-size: 13px; font-weight: 600;
}
.home-stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 28px;
}
.stat-card {
  padding: 20px 16px; text-align: center;
}
.stat-icon { font-size: 22px; margin-bottom: 8px; }
.stat-value {
  font-size: 28px; font-weight: 800; letter-spacing: -.5px;
  color: var(--primary);
}
.stat-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .7px; color: var(--text-muted); margin-top: 4px;
}
.home-actions-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 28px;
}
.action-card {
  padding: 22px 18px; cursor: pointer;
}
.action-icon { font-size: 30px; margin-bottom: 10px; }
.action-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.action-desc  { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.home-lf-preview {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 14px;
}
.lf-mini-card {
  padding: 14px 10px; text-align: center; cursor: pointer;
}
.lf-mini-num { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; }
.lf-mini-bar { margin: 6px 0 4px; }
.lf-mini-pct { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════════════
   LERNFELDER VIEW
═══════════════════════════════════════════════════════════════════════════ */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
  padding: 7px 16px; border-radius: 99px;
  font-size: 13px; font-weight: 600;
  background: var(--bg-card); color: var(--text-muted);
  border: 1.5px solid var(--border);
  transition: all .15s ease;
}
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.lf-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.lf-card {
  padding: 18px 20px; cursor: pointer; display: flex; gap: 16px; align-items: flex-start;
}
.lf-badge {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--primary-light); color: var(--primary-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
}
.lf-badge.shared { background: var(--accent-light); color: #1D4ED8; }
.dark .lf-badge.shared { color: #93C5FD; }
.lf-info { flex: 1; min-width: 0; }
.lf-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; line-height: 1.4; }
.lf-desc  { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lf-meta  { display: flex; align-items: center; gap: 8px; }
.lf-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* LF Detail */
.lf-detail-hero {
  background: linear-gradient(135deg, #0F172A 0%, #134E4A 100%);
  border-radius: var(--radius-lg); padding: 24px 20px; color: #fff; margin-bottom: 20px;
}
.lf-detail-num   { font-size: 13px; font-weight: 700; opacity: .75; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.lf-detail-title { font-size: 20px; font-weight: 800; line-height: 1.3; }
.lf-detail-tags  { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.lf-detail-tag   { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.25); padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.lf-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.lf-stat-box { padding: 14px 12px; text-align: center; }
.lf-stat-val { font-size: 22px; font-weight: 800; color: var(--primary); }
.lf-stat-lbl { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }
.lf-quiz-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ══════════════════════════════════════════════════════════════════════════
   EXAM VIEW
═══════════════════════════════════════════════════════════════════════════ */
.exam-intro { text-align: center; padding: 16px 0 28px; }
.exam-intro h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.exam-intro p  { color: var(--text-muted); font-size: 15px; max-width: 480px; margin: 0 auto 24px; }
.exam-grid     { display: grid; gap: 14px; }
.exam-card     { padding: 24px 20px; cursor: pointer; }
.exam-card-inner { display: flex; align-items: center; gap: 18px; }
.exam-icon-wrap {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
}
.exam-icon-wrap.ap1 { background: var(--primary-light); }
.exam-icon-wrap.si  { background: var(--accent-light); }
.exam-icon-wrap.ae  { background: var(--warning-light); }
.exam-text { flex: 1; }
.exam-card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.exam-card-sub   { font-size: 13px; color: var(--text-muted); }
.exam-card-meta  { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.exam-chevron    { color: var(--text-light); flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   QUIZ VIEW
═══════════════════════════════════════════════════════════════════════════ */
.quiz-header {
  position: sticky; top: var(--mh); z-index: 50;
  background: var(--bg); padding: 12px 0 10px;
  border-bottom: 1px solid var(--border);
  margin: 0 -16px; padding-left: 16px; padding-right: 16px;
}
.quiz-header-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.quiz-counter { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.quiz-timer {
  font-size: 15px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.quiz-timer.urgent { color: var(--error); animation: pulse-urgent 1s ease-in-out infinite; }
@keyframes pulse-urgent { 0%,100%{opacity:1} 50%{opacity:.5} }
.quiz-abort-btn {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.quiz-abort-btn:hover { color: var(--error); }
.quiz-body { padding: 20px 0; }
.question-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.question-text {
  font-size: 16px; font-weight: 600; line-height: 1.65;
  margin-bottom: 22px; white-space: pre-line;
}
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1.5px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 500;
  text-align: left; line-height: 1.5; width: 100%;
  transition: all .15s ease; cursor: pointer;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary-text);
}
.option-letter {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted); transition: all .15s;
}
.option-btn:hover:not(:disabled) .option-letter {
  border-color: var(--primary); color: var(--primary); background: var(--primary-light);
}
.option-btn.correct   { border-color: var(--success); background: var(--success-light); color: var(--success-text); cursor: default; }
.option-btn.correct .option-letter { border-color: var(--success); background: var(--success); color: #fff; }
.option-btn.wrong     { border-color: var(--error);   background: var(--error-light);   color: var(--error-text);   cursor: default; }
.option-btn.wrong .option-letter   { border-color: var(--error);   background: var(--error);   color: #fff; }
.option-btn.missed    { border-color: var(--success); background: var(--success-light); color: var(--success-text); cursor: default; opacity: .7; }
.option-btn:disabled  { cursor: default; }
.option-btn.selected:not(.correct):not(.wrong) {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary-text);
}
.option-btn.selected:not(.correct):not(.wrong) .option-letter {
  border-color: var(--primary); background: var(--primary); color: #fff;
}
.explanation-card {
  margin-top: 16px; padding: 16px 18px; border-radius: var(--radius);
  border-left: 4px solid; animation: slide-in .2s ease;
}
.explanation-card.correct { background: var(--success-light); border-color: var(--success); }
.explanation-card.wrong   { background: var(--error-light);   border-color: var(--error); }
@keyframes slide-in { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:none} }
.explanation-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.explanation-title.correct { color: var(--success-text); }
.explanation-title.wrong   { color: var(--error-text); }
.explanation-text { font-size: 13px; line-height: 1.65; color: var(--text); }
.quiz-footer {
  position: sticky; bottom: var(--bn-h); z-index: 50;
  background: var(--bg); padding: 12px 0;
  border-top: 1px solid var(--border);
  margin: 0 -16px; padding-left: 16px; padding-right: 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.quiz-bookmark-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  padding: 8px 12px; border-radius: var(--radius-sm); transition: all .15s;
}
.quiz-bookmark-btn:hover { color: var(--warning); background: var(--warning-light); }
.quiz-bookmark-btn.active { color: var(--warning); }

/* Quiz Result */
.result-header { text-align: center; padding: 32px 16px 28px; }
.result-score-ring {
  width: 130px; height: 130px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  background: conic-gradient(var(--primary) 0deg, var(--primary) calc(var(--pct,0) * 3.6deg), var(--border) calc(var(--pct,0) * 3.6deg));
  box-shadow: var(--shadow-md); position: relative;
}
.result-score-ring::before {
  content: ''; position: absolute; inset: 10px;
  background: var(--bg-card); border-radius: 50%;
}
.result-score-inner { position: relative; z-index: 1; text-align: center; }
.result-score-pct  { font-size: 30px; font-weight: 800; line-height: 1; color: var(--primary); }
.result-score-frac { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.result-verdict    { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.result-verdict.pass { color: var(--success-text); }
.result-verdict.fail { color: var(--error-text); }
.result-sub         { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.result-meta-row    { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result-action-row  { display: grid; gap: 10px; padding: 0 16px 20px; }
.result-review      { padding: 0 16px; }
.review-item {
  padding: 14px 16px; margin-bottom: 10px;
  border-radius: var(--radius); border: 1.5px solid var(--border);
}
.review-item.review-correct { border-color: var(--success); }
.review-item.review-wrong   { border-color: var(--error); }
.review-q { font-size: 13px; font-weight: 600; margin-bottom: 8px; white-space: pre-line; }
.review-answers { display: flex; flex-direction: column; gap: 4px; }
.review-answer  { font-size: 13px; padding: 4px 10px; border-radius: var(--radius-sm); font-weight: 500; }
.review-answer.ra-correct { background: var(--success-light); color: var(--success-text); }
.review-answer.ra-wrong   { background: var(--error-light);   color: var(--error-text); }
.review-exp {
  margin-top: 8px; font-size: 13px; color: var(--text-muted);
  line-height: 1.55; padding-top: 8px; border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════════════════
   STATS VIEW
═══════════════════════════════════════════════════════════════════════════ */
.stats-overview { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 28px; }
.stats-big-card  { padding: 22px 18px; }
.stats-big-val   { font-size: 34px; font-weight: 800; color: var(--primary); letter-spacing: -.5px; }
.stats-big-lbl   { font-size: 13px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }
.lf-progress-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.lf-progress-row  { display: flex; align-items: center; gap: 12px; }
.lf-progress-label { flex: 1; font-size: 13px; font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lf-progress-bar-wrap { width: 120px; }
.lf-progress-pct { font-size: 12px; font-weight: 700; color: var(--primary); width: 36px; text-align: right; }
.sessions-list { display: flex; flex-direction: column; gap: 8px; }
.session-row {
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.session-icon  { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.session-info  { flex: 1; min-width: 0; }
.session-type  { font-size: 13px; font-weight: 600; }
.session-sub   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.session-score { font-size: 14px; font-weight: 800; }
.session-score.good { color: var(--success-text); }
.session-score.bad  { color: var(--error-text); }

/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS VIEW
═══════════════════════════════════════════════════════════════════════════ */
.settings-group { margin-bottom: 28px; }
.settings-group-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--text-muted); margin-bottom: 8px; padding: 0 4px;
}
.settings-card { overflow: hidden; }
.setting-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; background: var(--bg); }
.setting-label { flex: 1; }
.setting-name  { font-size: 14px; font-weight: 600; }
.setting-desc  { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-thumb {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 99px; transition: background .2s;
}
.toggle-thumb::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-thumb { background: var(--primary); }
.toggle-switch input:checked + .toggle-thumb::after { transform: translateX(20px); }
.fachrichtung-select-row { display: flex; gap: 8px; padding: 8px 16px 14px; flex-wrap: wrap; }
.fachrichtung-opt {
  flex: 1; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-card);
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  text-align: center; cursor: pointer; min-width: 100px; transition: all .15s;
}
.fachrichtung-opt.active {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary-text);
}
.fachrichtung-opt:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.setting-version { text-align: center; color: var(--text-muted); font-size: 13px; padding: 16px; }

/* ── App Footer ─────────────────────────────────────────────────────────── */
.app-footer {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px;
  padding: 14px 20px calc(var(--bn-h) + 16px);
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.af-sep { opacity: .35; }
.af-link { color: var(--text-muted); text-decoration: none; transition: color var(--t); }
.af-link:hover { color: var(--primary); text-decoration: underline; }
@media (min-width: 1024px) {
  .app-footer { padding-bottom: 20px; }
}

/* Account section in settings */
.account-card {
  padding: 20px; display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
}
.account-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-info { flex: 1; }
.account-name  { font-size: 16px; font-weight: 700; }
.account-email { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.account-badge { margin-top: 6px; }

/* ══════════════════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: fade-in .15s ease;
}
@keyframes fade-in { from{opacity:0} to{opacity:1} }
.modal {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 28px 24px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-xl); animation: slide-up .2s ease;
}
@keyframes slide-up { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:none} }
.modal-icon    { font-size: 36px; text-align: center; margin-bottom: 12px; }
.modal-title   { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 8px; }
.modal-body    { font-size: 14px; color: var(--text-muted); text-align: center; line-height: 1.65; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   EMPTY STATE & MISC
═══════════════════════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon  { font-size: 52px; margin-bottom: 16px; }
.empty-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-desc  { font-size: 14px; color: var(--text-muted); }
.divider     { height: 1px; background: var(--border); margin: 20px 0; }
.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--text-muted); margin-bottom: 12px;
}
.sync-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--success-text);
  background: var(--success-light); padding: 3px 8px; border-radius: 99px;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Desktop (sidebar always visible)
═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0) !important;
    box-shadow: none;
  }
  .sidebar-close-btn { display: none; }
  .mobile-header { display: none; }
  #bottom-nav { display: none; }
  #main-content {
    margin-left: var(--sidebar-w);
    padding-top: 36px;
    padding-bottom: 48px;
  }
  .page, .page-wide { padding: 0 32px 48px; }
  .page-header h1 { font-size: 32px; }
  .home-stats-row { gap: 16px; }
  .home-actions-grid { grid-template-columns: repeat(4, 1fr); }
  .home-lf-preview  { grid-template-columns: repeat(6, 1fr); }
  .lf-grid          { grid-template-columns: 1fr 1fr; }
  .exam-grid        { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; }
  .stats-overview   { grid-template-columns: repeat(4, 1fr); }
  .result-action-row { grid-template-columns: repeat(3, 1fr); }
  .lf-quiz-btns     { grid-template-columns: repeat(4, 1fr); }
  .quiz-header      { margin: 0; padding-left: 0; padding-right: 0; top: 0; }
  .quiz-footer      { margin: 0; padding-left: 0; padding-right: 0; bottom: 0; }
  .question-text    { font-size: 17px; }
  .modal { padding: 36px 32px; }
  .fr-options { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1280px) {
  :root { --sidebar-w: 280px; }
  .lf-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  /* tablet – sidebar hidden but bottom nav hidden too */
  #bottom-nav { display: none; }
  #main-content {
    padding-top: calc(var(--mh) + 24px);
    padding-bottom: 48px;
  }
  .home-actions-grid { grid-template-columns: repeat(4, 1fr); }
  .home-lf-preview { grid-template-columns: repeat(6, 1fr); }
  .stats-overview  { grid-template-columns: repeat(4, 1fr); }
  .lf-grid { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════════════════════════ */
.hidden           { display: none !important; }
.text-center      { text-align: center; }
.text-muted       { color: var(--text-muted); }
.font-bold        { font-weight: 700; }
.mt-4             { margin-top: 16px; }
.mt-6             { margin-top: 24px; }
.mb-4             { margin-bottom: 16px; }
.gap-2            { gap: 8px; }
.flex             { display: flex; }
.flex-center      { display: flex; align-items: center; justify-content: center; }
.between          { justify-content: space-between; }
.items-center     { align-items: center; }
.w-full           { width: 100%; }

/* -- Achievement Toast -- */
.achievement-toast {
  position: fixed; bottom: 80px; right: 20px; z-index: 9999;
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card, #fff); border-radius: 14px;
  padding: 14px 18px; max-width: 320px; width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  border-left: 4px solid var(--primary);
  transform: translateX(120%); opacity: 0;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .35s ease;
  pointer-events: none;
}
.achievement-toast.show { transform: translateX(0); opacity: 1; }
.achievement-toast.rarity-toast-uncommon { border-color: #16A34A; }
.achievement-toast.rarity-toast-rare     { border-color: #4F46E5; }
.achievement-toast.rarity-toast-epic     { border-color: #7C3AED; }
.toast-icon  { font-size: 32px; flex-shrink: 0; line-height: 1; }
.toast-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }
.toast-name  { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 2px; }
.toast-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* -- Achievements Grid -- */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.achievement-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 16px;
  transition: box-shadow .15s, border-color .15s;
}
.achievement-card.unlocked { border-color: var(--primary); }
.achievement-card.locked   { opacity: .55; filter: grayscale(.4); }
.achievement-card.unlocked:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.ach-icon  { font-size: 32px; flex-shrink: 0; line-height: 1; }
.ach-info  { flex: 1; min-width: 0; }
.ach-name  { font-size: 14px; font-weight: 700; color: var(--text); }
.ach-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.ach-meta  { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ach-date  { font-size: 11px; color: var(--text-muted); }
.ach-check { font-size: 18px; color: var(--primary); font-weight: 700; flex-shrink: 0; }
.ach-lock  { font-size: 16px; flex-shrink: 0; opacity: .5; }
.ach-rarity {
  display: inline-block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 8px; border-radius: 99px;
}
.rarity-badge-common   { background: #F1F5F9; color: #475569; }
.rarity-badge-uncommon { background: #DCFCE7; color: #15803D; }
.rarity-badge-rare     { background: #EEF2FF; color: #3730A3; }
.rarity-badge-epic     { background: #FDF4FF; color: #7E22CE; }
.progress-wrap.progress-thick { height: 10px; }

/* ── Support & Changelog views ──────────────────────────────────────────── */

/* === SUPPORT === */
.support-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.support-ticket-list { display: flex; flex-direction: column; gap: 10px; }
.support-ticket-card {
  background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 16px 18px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  display: flex; align-items: center; gap: 14px;
}
.support-ticket-card:hover {
  border-color: var(--primary); box-shadow: 0 4px 16px rgba(16,185,129,.12);
  transform: translateY(-1px);
}
.stc-icon {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stc-body { flex: 1; min-width: 0; }
.stc-subject { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stc-cat {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 999px;
}
.stc-status  { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.stc-date { font-size: 11px; color: var(--text-muted); }
.stc-arrow { color: var(--text-muted); flex-shrink: 0; transition: transform .15s, color .15s; }
.support-ticket-card:hover .stc-arrow { transform: translateX(4px); color: var(--primary); }

/* New ticket form card */
.new-ticket-card {
  background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 16px;
  overflow: hidden; margin-bottom: 24px;
}
.new-ticket-card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.new-ticket-card-header-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.new-ticket-card-title { font-size: 14px; font-weight: 700; }
.new-ticket-card-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.ntc-row { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
@media(max-width:540px){ .ntc-row { grid-template-columns: 1fr; } }
.ntc-form-group { display: flex; flex-direction: column; gap: 6px; }
.ntc-form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.ntc-cat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.ntc-cat-btn {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 8px;
  font-size: 12px; font-weight: 600; text-align: center; cursor: pointer;
  background: var(--bg); color: var(--text-muted); transition: all .15s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ntc-cat-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.ntc-cat-btn.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 700; }
.ntc-cat-btn .ntc-cat-icon { font-size: 20px; }
.ntc-input {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; background: var(--bg); color: var(--text);
  transition: border-color .15s; width: 100%; outline: none;
}
.ntc-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,.12); }
.ntc-input::placeholder { color: var(--text-muted); }
textarea.ntc-input { resize: none; }

/* Empty state */
.support-empty {
  text-align: center; padding: 50px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.support-empty-icon { font-size: 42px; opacity: .5; }
.support-empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.support-empty-sub   { font-size: 13px; color: var(--text-muted); }

/* === TICKET CHAT (user side) === */
.ticket-chat-page { display: flex; flex-direction: column; height: calc(100vh - 130px); min-height: 500px; }
.ticket-chat-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.ticket-chat-info { flex: 1; min-width: 0; }
.ticket-chat-title { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-chat-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.user-chat-container {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 16px;
}
.user-chat-messages {
  flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.user-chat-msg { display: flex; flex-direction: column; max-width: 68%; }
.user-chat-msg.staff { align-self: flex-start; align-items: flex-start; }
.user-chat-msg.user  { align-self: flex-end;   align-items: flex-end; }
.user-chat-msg.staff .chat-bubble {
  background: var(--bg); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px;
}
.user-chat-msg.user  .chat-bubble {
  background: var(--primary); color: #fff; border-bottom-right-radius: 4px;
}
.chat-bubble { padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55; word-break: break-word; white-space: pre-wrap; }
.chat-msg-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.chat-msg-name { font-weight: 700; }
.chat-day-sep {
  display: flex; align-items: center; gap: 10px; margin: 6px 0;
  font-size: 11px; color: var(--text-muted); font-weight: 600;
}
.chat-day-sep::before, .chat-day-sep::after { content:''; flex:1; height:1px; background: var(--border); }
.chat-input-area {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 16px; border-top: 1.5px solid var(--border); background: var(--bg-card);
}
.chat-input-area textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 120px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; background: var(--bg); color: var(--text); outline: none;
  transition: border-color .15s;
}
.chat-input-area textarea:focus { border-color: var(--primary); }

/* === CHANGELOG === */
.cl-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.cl-page-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.cl-page-sub   { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.cl-version-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-light); color: var(--primary); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.cl-version-pill svg { stroke: var(--primary); }

.cl-cat-section { margin-bottom: 28px; }
.cl-cat-header  {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1.5px solid var(--border);
}
.cl-cat-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 10px; border-radius: 999px;
}
.cl-cat-label.features { background: var(--accent-light); color: #1D4ED8; }
.cl-cat-label.changes  { background: var(--warning-light); color: var(--warning-text); }
.cl-cat-label.bugfix   { background: var(--error-light); color: var(--error-text); }
.dark .cl-cat-label.features { background: rgba(59,130,246,.15); color: #93C5FD; }
.dark .cl-cat-label.changes  { background: rgba(245,158,11,.15); color: #FCD34D; }
.dark .cl-cat-label.bugfix   { background: rgba(239,68,68,.15);  color: #FCA5A5; }
.cl-entry-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  margin-bottom: 8px; transition: border-color .15s;
}
.cl-entry-card:hover { border-color: var(--primary); }
.cl-entry-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px;
}
.cl-entry-dot.features { background: var(--accent); }
.cl-entry-dot.changes  { background: var(--warning); }
.cl-entry-dot.bugfix   { background: var(--error); }
.cl-entry-content { flex: 1; }
.cl-entry-headline { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.cl-entry-bullets  { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.cl-entry-bullet   { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: flex-start; }
.cl-entry-bullet::before { content: '–'; color: var(--text-muted); flex-shrink: 0; }
.cl-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px; }
