/* ============================================================
   Familien-Hub — Stylesheet
   Warm, modern, mobile-first
   Font: Nunito (friendly) + JetBrains Mono (code)
   ============================================================ */

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

/* ── Variables ────────────────────────────────────────────── */
:root {
  --font: 'Nunito', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colors */
  --primary:      #f97316;
  --primary-dark: #ea6c0a;
  --primary-soft: #fff7ed;
  --accent:       #6366f1;
  --accent-soft:  #eef2ff;
  --success:      #22c55e;
  --success-soft: #f0fdf4;
  --warning:      #f59e0b;
  --warning-soft: #fffbeb;
  --danger:       #ef4444;
  --danger-soft:  #fef2f2;
  --info:         #3b82f6;

  /* Light theme */
  --bg:           #faf9f7;
  --bg-card:      #ffffff;
  --bg-subtle:    #f3f2ef;
  --border:       #e8e5e0;
  --text:         #1c1917;
  --text-muted:   #78716c;
  --text-light:   #a8a29e;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:    0 10px 32px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.05);
  --radius:       14px;
  --radius-sm:    8px;
  --radius-lg:    20px;
  --nav-h:        64px;
}

[data-theme="dark"] {
  --bg:        #17150f;
  --bg-card:   #211e16;
  --bg-subtle: #2a2520;
  --border:    #3d3730;
  --text:      #faf9f7;
  --text-muted:#a8a29e;
  --text-light:#57534e;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow:    0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 32px rgba(0,0,0,.5);
  --primary-soft: #431407;
  --accent-soft:  #1e1b4b;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button, input, select, textarea {
  font-family: var(--font);
  font-size: inherit;
}

/* ── Layout ───────────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  padding: 1.25rem 1rem 6rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 768px) {
  .app-main { padding: 2rem 1.5rem 2rem; }
}

/* ── Top Header ───────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.app-header__logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  overflow: hidden;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Bottom Navigation (mobile) ───────────────────────────── */
.app-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  height: 62px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.07);
  padding-bottom: env(safe-area-inset-bottom);
}

.app-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-light);
  font-size: .65rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  padding: 6px 0;
  transition: color .15s;
  position: relative;
}

.app-nav__item svg { width: 22px; height: 22px; }

.app-nav__item.active {
  color: var(--primary);
}

.app-nav__item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

.nav-badge {
  position: absolute;
  top: 6px; right: calc(50% - 18px);
  background: var(--danger);
  color: white;
  font-size: .6rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

@media (min-width: 768px) {
  .app-nav { display: none; }
  .app-main { padding-bottom: 2rem; }
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.25rem;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: .2rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent    { background: var(--accent); color: white; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-success   { background: var(--success); color: white; }
.btn-danger    { background: var(--danger); color: white; }
.btn-outline   { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--bg-subtle); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }
.btn-sm        { padding: .4rem .875rem; font-size: .8rem; }
.btn-lg        { padding: .875rem 1.75rem; font-size: 1rem; }
.btn-icon      { padding: .5rem; border-radius: 50%; }
.btn-block     { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: .875rem;
  margin-bottom: .375rem;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2378716c'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 1.25rem; padding-right: 2.5rem; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Badges / Tags ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .625rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-accent  { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-muted   { background: var(--bg-subtle); color: var(--text-muted); }

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-sm  { width: 32px; height: 32px; font-size: .9rem; }
.avatar-md  { width: 44px; height: 44px; font-size: 1.2rem; }
.avatar-lg  { width: 64px; height: 64px; font-size: 1.8rem; }
.avatar-xl  { width: 88px; height: 88px; font-size: 2.5rem; }

/* ── Progress ─────────────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--warning));
  border-radius: 999px;
  transition: width .5s ease;
}

/* ── Lists ────────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open .modal {
  transform: translateY(0);
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius-lg); }
}

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--nav-h) + .75rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
  display: flex; align-items: center; gap: .5rem;
  min-width: 220px; max-width: 340px;
  pointer-events: all;
}
.toast-success { background: var(--success); color: white; }
.toast-error   { background: var(--danger); color: white; }
.toast-info    { background: var(--accent); color: white; }

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

/* ── Dashboard Grid ───────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .875rem;
}
.dashboard-grid .span-2 { grid-column: 1 / -1; }

@media (min-width: 480px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-card__icon {
  font-size: 1.5rem;
  margin-bottom: .25rem;
}
.stat-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--primary);
}
.stat-card__label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Task Items ───────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: .875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  transition: box-shadow .15s;
}
.task-item:hover { box-shadow: var(--shadow); }

.task-checkbox {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  margin-top: 2px;
}
.task-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.task-checkbox.pending {
  background: var(--warning-soft);
  border-color: var(--warning);
}

.task-info { flex: 1; min-width: 0; }
.task-title { font-weight: 700; font-size: .95rem; }
.task-meta  { font-size: .8rem; color: var(--text-muted); display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .2rem; }
.task-points { font-size: .8rem; font-weight: 700; color: var(--primary); font-family: var(--font-mono); }

/* ── Calendar ─────────────────────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-day-header {
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: .5rem 0;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .1s;
  font-size: .85rem;
  font-weight: 600;
  position: relative;
}
.cal-day:hover { background: var(--bg-subtle); }
.cal-day.today { background: var(--primary); color: white; }
.cal-day.other-month { color: var(--text-light); }
.cal-day .dot-row {
  display: flex; gap: 2px; margin-top: 2px;
}
.cal-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
}

/* ── Timetable ────────────────────────────────────────────── */
.timetable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.timetable table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 340px;
}
.timetable th, .timetable td {
  padding: .5rem .4rem;
  text-align: center;
  border: 1px solid var(--border);
}
.timetable th {
  background: var(--bg-subtle);
  font-weight: 700;
  font-size: .75rem;
}
.timetable .period-label {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 600;
}
.timetable-cell {
  border-radius: 6px;
  padding: .3rem .4rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ── Leaderboard ──────────────────────────────────────────── */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-rank {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.rank-1 { color: #f59e0b; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #cd7c4f; }

/* ── Shopping List ────────────────────────────────────────── */
.shopping-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .875rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.shopping-item.done { opacity: .5; }
.shopping-item.done .shopping-title { text-decoration: line-through; }
.shopping-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.shopping-check.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* ── Countdown Cards ──────────────────────────────────────── */
.countdown-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.countdown-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.countdown-days {
  font-size: 3rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
}
.countdown-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; margin-top: .25rem; }

/* ── Board Posts ──────────────────────────────────────────── */
.board-post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: .625rem;
}
.board-post.pinned {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ── Meal Plan ────────────────────────────────────────────── */
.meal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 500px;
}

/* ── Utilities ────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-gap    { display: flex; align-items: center; gap: .75rem; }
.grid-2      { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .85rem; }
.text-xs     { font-size: .75rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-bold     { font-weight: 700; }
.fw-heavy    { font-weight: 800; }
.w-full      { width: 100%; }
.d-none      { display: none !important; }
.rounded     { border-radius: var(--radius); }
.rounded-full{ border-radius: 999px; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: .75rem; }

/* ── Login ────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 50%, #ecfdf5 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
[data-theme="dark"] .login-wrap {
  background: linear-gradient(135deg, #431407 0%, #292524 50%, #14532d 100%);
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 1.5rem;
}
.login-title {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: .25rem;
}
.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: .9rem;
}

/* ── Admin ────────────────────────────────────────────────── */
.admin-header {
  background: var(--accent);
  color: white;
  padding: .5rem 1.25rem;
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; gap: .5rem;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideUp  { from { transform:translateY(20px); opacity:0 } to { transform:translateY(0); opacity:1 } }
@keyframes pulse    { 0%,100% { transform:scale(1) } 50% { transform:scale(1.05) } }
@keyframes spin     { to { transform:rotate(360deg) } }

.animate-fade  { animation: fadeIn .3s ease both; }
.animate-pulse { animation: pulse 2s infinite; }
.loading { animation: spin 1s linear infinite; }

/* ── PWA safe area ────────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(62px + env(safe-area-inset-bottom)); }
}

/* ── App Shell (Sidebar Layout) ───────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.app-sidebar {
  display: none; /* mobile: hidden */
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

@media (max-width: 767px) {
  .app-sidebar { display: none !important; }
}

@media (min-width: 768px) {
  .app-sidebar { display: flex; }
  .app-nav     { display: none; }
  .app-main    { padding-bottom: 2rem; }
}

.sidebar-logo {
  padding: 1.25rem 1rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: .75rem .5rem;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
  padding: .25rem .75rem;
  margin-top: .25rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  transition: background .1s, color .1s;
  position: relative;
}
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-item:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.sidebar-item.active { background: var(--primary-soft); color: var(--primary); }

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: .6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-footer {
  padding: .75rem .5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Header adjustments ───────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.app-header__left {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1;
  min-width: 0;
}

.app-header__pagetitle {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 768px) {
  .app-header__logo.sidebar-hidden { display: none; }
}
