/* finesse · register=h5 · morph=A.1-daily-desk · palette=warm-stone+amber
 * SOUL=7 SPECTACLE=3 DENSITY=6 · children habit tracker */

:root {
  /* === Warm Stone palette (tinted toward amber) === */
  --page: #f4efe6;
  --bg: #fffbef;
  --panel-2: #faf4e8;
  --panel-3: #f4ead6;
  --border: rgba(88, 64, 20, 0.09);
  --border-strong: rgba(88, 64, 20, 0.16);

  /* ink */
  --ink-1: #2b1e10;
  --ink-2: #5c4a34;
  --ink-3: #8c7859;
  --ink-4: #b8a989;

  /* accent — warm amber / honey */
  --accent: #d98a2a;
  --accent-deep: #b7731a;
  --accent-2: #e8a94b;
  --accent-soft: rgba(217, 138, 42, 0.12);
  --accent-soft-2: rgba(217, 138, 42, 0.20);
  --on-accent: #fff;
  --glow: 0 12px 28px -8px rgba(217, 138, 42, 0.45);

  /* children-friendly secondary */
  --kid-coral: #e57c6d;
  --kid-mint: #6ab296;
  --kid-sky: #6ba4d6;
  --kid-lilac: #9c8bc4;

  /* semantic */
  --up: #5fa35c;
  --down: #d66b60;
  --warn: #d9a23c;

  /* shadows — warm tinted, never pure black */
  --shadow: 0 1px 3px rgba(80, 50, 10, 0.06);
  --shadow-md: 0 6px 20px -8px rgba(80, 50, 10, 0.15);
  --shadow-lg: 0 40px 90px -50px rgba(80, 50, 10, 0.35);

  /* radius tiers */
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 28px;
  --r-xl: 36px;

  /* spacing (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;

  /* type scale */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* z-index */
  --z-sticky: 20;
  --z-modal: 100;
  --z-tabbar: 50;
  --z-status: 60;
}

/* === Reset === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body { height: 100%; width: 100%; overflow-x: clip; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* === Phone Frame (H5 container) === */
.phone {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

@media (min-width: 560px) {
  body {
    background:
      radial-gradient(120% 80% at 50% 0%, #ead9bf 0%, #c9ac82 40%, #a8855e 75%, #7a5c3a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .phone {
    width: 406px;
    height: min(870px, 94vh);
    border-radius: 48px;
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow:
      0 50px 130px -30px rgba(60, 35, 10, 0.55),
      0 0 0 12px #1a1108;
    overflow: hidden;
  }
}

/* === Status Bar === */
.status {
  flex: none;
  height: calc(env(safe-area-inset-top) + 42px);
  padding: env(safe-area-inset-top) 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  background: transparent;
  z-index: var(--z-status);
  position: relative;
}
.status__right { display: flex; align-items: center; gap: 5px; opacity: .8; }
.status__icon { width: 14px; height: 14px; }

/* === App Scroll Container === */
#app {
  flex: 1;
  overflow-y: auto;
  overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom) + 110px);
  scroll-behavior: smooth;
}
#app::-webkit-scrollbar { width: 0; }

/* === Page Views === */
.view {
  display: none;
  padding: 8px 20px 20px;
  animation: viewEnter .35s ease;
}
.view.active { display: block; }

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === Dashboard Header === */
.dash-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 18px;
}
.avatar-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow);
  flex: none;
  transition: transform .15s ease;
}
.avatar-btn:active { transform: scale(0.94); }
.avatar-btn img,
.avatar-btn svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-btn__badge {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 22px; height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  border: 2px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.dash-header__text { flex: 1; min-width: 0; }
.dash-header__greeting {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.dash-header__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* === KPI Points Card === */
.kpi-card {
  position: relative;
  background: linear-gradient(140deg, #f3c070 0%, #e8a038 50%, #d9832a 100%);
  border-radius: var(--r-lg);
  padding: 22px 22px 24px;
  color: #fff;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: var(--glow);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -20px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(255,255,255,.25) 0%, transparent 65%);
  border-radius: 50%;
}
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(120,60,0,.2) 0%, transparent 65%);
  border-radius: 50%;
}
.kpi-card__inner { position: relative; z-index: 1; }
.kpi-card__label {
  font-size: 13px;
  font-weight: 500;
  opacity: .92;
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.kpi-card__value {
  font-size: 44px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.05;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.kpi-card__unit {
  font-size: 15px;
  font-weight: 500;
  opacity: .9;
  margin-left: 2px;
}
.kpi-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 10px;
}
.kpi-card__level {
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.kpi-card__today {
  font-size: 12px;
  opacity: .92;
  text-align: right;
}
.kpi-card__today b { font-weight: 700; }

/* === Section Header === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 12px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: -0.005em;
}
.section-subtitle {
  font-size: 12px;
  color: var(--ink-3);
}

/* === Habit Cards === */
.habit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}
.habit-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 14px 14px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s ease;
  overflow: hidden;
}
.habit-card:active { transform: scale(0.985); }
.habit-card.completed {
  background: var(--panel-2);
  border-color: rgba(95, 163, 92, 0.22);
}
.habit-card.completed .habit-card__name {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--ink-4);
}

.habit-card__icon {
  width: 50px; height: 50px;
  flex: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--accent-soft);
}

.habit-card__body { flex: 1; min-width: 0; }
.habit-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: 3px;
  text-wrap: balance;
}
.habit-card__points {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.habit-card__points b {
  color: var(--accent-deep);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.habit-card__action {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px -3px rgba(217,138,42,.5);
  transition: all .18s ease;
}
.habit-card.completed .habit-card__action {
  background: var(--up);
  box-shadow: 0 4px 12px -3px rgba(95,163,92,.4);
}
.habit-card__action:active { transform: scale(0.9); }

/* === Weekly Chart Card === */
.chart-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.chart-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.chart-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-1);
}
.chart-card__subtitle {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  padding-top: 10px;
}
.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.chart-bar__fill {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 7px 7px 4px 4px;
  min-height: 4px;
  transition: height .6s cubic-bezier(.22,1,.36,1);
  position: relative;
}
.chart-bar.today .chart-bar__fill {
  background: linear-gradient(180deg, #f2c466, #e6932a);
  box-shadow: 0 3px 10px -2px rgba(217,138,42,.5);
}
.chart-bar__val {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}
.chart-bar__label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}

/* === Level Progress Card === */
.level-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.level-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.level-card__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-1);
}
.level-card__next {
  font-size: 12px;
  color: var(--ink-3);
}
.level-card__bar {
  height: 10px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.level-card__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 999px;
  transition: width .6s cubic-bezier(.22,1,.36,1);
}

/* === TabBar === */
.tabbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  width: calc(100% - 36px);
  max-width: 380px;
  height: 62px;
  background: rgba(255,251,239, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  box-shadow: 0 8px 24px -6px rgba(80,50,10,.2);
  z-index: var(--z-tabbar);
}
.tabbar__item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color .2s ease;
  position: relative;
}
.tabbar__item:active { transform: scale(0.92); }
.tabbar__item.active { color: var(--accent-deep); }
.tabbar__icon { font-size: 20px; line-height: 1; }
.tabbar__item.active .tabbar__icon { transform: translateY(-1px); }

/* Home indicator */
.home-ind {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 128px;
  height: 4px;
  border-radius: 999px;
  background: var(--ink-3);
  opacity: 0.3;
  z-index: var(--z-tabbar);
  pointer-events: none;
}

/* === Admin View === */
.admin-view { padding: 8px 20px 20px; }
.admin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 18px;
}
.admin-back {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all .15s ease;
}
.admin-back:active { transform: scale(0.92); }
.admin-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-1);
  flex: 1;
}

.admin-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.admin-section__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 14px 16px 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.admin-list { padding: 0 6px 8px; }
.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 12px;
  transition: background .15s ease;
  cursor: pointer;
}
.admin-row:active { background: var(--panel-2); }
.admin-row__icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex: none;
}
.admin-row__body { flex: 1; min-width: 0; }
.admin-row__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: 2px;
}
.admin-row__sub {
  font-size: 12px;
  color: var(--ink-3);
}
.admin-row__arrow {
  color: var(--ink-4);
  font-size: 14px;
  flex: none;
}
.admin-btn {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-deep);
  background: transparent;
  border-top: 1px solid var(--border);
  transition: background .15s ease;
}
.admin-btn:active { background: var(--panel-2); }
.admin-btn.danger { color: var(--down); }

/* === Habit Admin List === */
.habit-admin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.habit-admin-item:last-child { border-bottom: none; }
.habit-admin-item__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex: none;
}
.habit-admin-item__body { flex: 1; min-width: 0; }
.habit-admin-item__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: 3px;
}
.habit-admin-item__meta {
  font-size: 12px;
  color: var(--ink-3);
  display: flex; gap: 8px;
}
.habit-admin-item__actions {
  display: flex;
  gap: 6px;
  flex: none;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all .15s ease;
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn.danger { color: var(--down); }

/* Switch toggle */
.switch {
  width: 42px;
  height: 26px;
  background: var(--panel-3);
  border-radius: 999px;
  position: relative;
  transition: background .2s ease;
  flex: none;
  cursor: pointer;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform .25s cubic-bezier(.22,1,.36,1);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }

/* === Modal / Sheet === */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(40, 25, 10, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .2s ease;
}
.modal-overlay.active { display: flex; }

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

.modal-sheet {
  width: 100%;
  max-width: 420px;
  background: var(--bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  animation: slideUp .3s cubic-bezier(.22,1,.36,1);
  max-height: 85vh;
  overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.sheet-grab {
  width: 38px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 999px;
  margin: 4px auto 14px;
}
.sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-1);
  margin-bottom: 16px;
  text-align: center;
}

/* === Forms === */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--ink-1);
  transition: border-color .2s ease, box-shadow .2s ease;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder { color: var(--ink-4); }

.form-row {
  display: flex;
  gap: 10px;
}
.form-row .form-group { flex: 1; }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  transition: all .15s ease;
  box-shadow: 0 4px 14px -4px rgba(217,138,42,.4);
}
.btn-primary:active { transform: scale(0.98); background: var(--accent-deep); }
.btn-secondary {
  width: 100%;
  padding: 14px;
  background: var(--panel-2);
  color: var(--ink-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  transition: all .15s ease;
}
.btn-secondary:active { transform: scale(0.98); background: var(--panel-3); }
.btn-danger {
  width: 100%;
  padding: 14px;
  background: var(--down);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  transition: all .15s ease;
}
.btn-danger:active { transform: scale(0.98); }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.form-actions button { flex: 1; }

/* icon picker grid */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.icon-option {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s ease;
}
.icon-option.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: scale(0.94);
}
.icon-option:active { transform: scale(0.9); }

/* === Toast === */
.toast-container {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 56px);
  left: 50%;
  transform: translateX(-50%);
  z-index: calc(var(--z-modal) + 10);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 86%;
  max-width: 320px;
}
.toast {
  background: rgba(43, 30, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,.3);
  animation: toastIn .3s ease, toastOut .3s ease 1.7s forwards;
  pointer-events: none;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

/* === Points popup animation === */
.points-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-deep);
  pointer-events: none;
  animation: pointsFloat 1s cubic-bezier(.22,1,.36,1) forwards;
  z-index: 10;
  text-shadow: 0 2px 8px rgba(217,138,42,.4);
}
@keyframes pointsFloat {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  30%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1); }
}

/* === Admin Login === */
.login-view {
  padding: 40px 28px 20px;
  text-align: center;
}
.login-icon {
  width: 68px; height: 68px;
  margin: 0 auto 18px;
  background: var(--accent-soft);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-1);
  margin-bottom: 6px;
}
.login-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 28px;
}

/* === Empty state === */
.empty-state {
  padding: 40px 20px;
  text-align: center;
}
.empty-state__icon { font-size: 48px; margin-bottom: 12px; opacity: .7; }
.empty-state__text { font-size: 14px; color: var(--ink-3); }

/* === Hidden file input === */
#avatar-input { display: none; }
#avatar-input-admin { display: none; }

/* === Admin nav secondary rows (sub-menu) === */
.admin-subheader {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 16px;
}
.admin-subheader__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-1);
  flex: 1;
}

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

/* === User Switcher === */
.user-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-1);
  background: none;
  border: none;
  cursor: pointer;
  margin-left: -4px;
  border-radius: 8px;
  transition: background .15s;
}
.user-switcher:active { background: rgba(0,0,0,0.05); }
.user-switcher svg { color: var(--ink-3); }

.user-dropdown {
  position: absolute;
  top: 70px;
  left: 20px;
  right: 20px;
  z-index: 30;
  display: none;
}
.user-dropdown.active { display: block; animation: dropIn .25s ease; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.user-dropdown__list {
  background: var(--bg);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}

.user-dropdown__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s;
}
.user-dropdown__item:active { background: var(--panel-2); }
.user-dropdown__item.active { background: var(--accent-soft); }
.user-dropdown__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel-2);
  flex: none;
  border: 2px solid transparent;
}
.user-dropdown__item.active .user-dropdown__avatar { border-color: var(--accent); }
.user-dropdown__avatar img,
.user-dropdown__avatar svg { width: 100%; height: 100%; object-fit: cover; }

.user-dropdown__info { flex: 1; min-width: 0; }
.user-dropdown__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-1);
  display: flex; align-items: center; gap: 6px;
}
.user-dropdown__points {
  font-size: 13px;
  color: var(--accent-deep);
  font-weight: 500;
}
.user-dropdown__check {
  font-size: 18px;
  color: var(--accent);
  opacity: 0;
}
.user-dropdown__item.active .user-dropdown__check { opacity: 1; }

/* === Leaderboard === */
.leaderboard {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.leaderboard__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  transition: background .15s;
}
.leaderboard__item.current {
  background: var(--accent-soft);
}
.leaderboard__rank {
  width: 28px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
}
.leaderboard__rank.gold { color: #e8a94b; }
.leaderboard__rank.silver { color: #a8a29e; }
.leaderboard__rank.bronze { color: #c2703a; }

.leaderboard__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel-2);
  flex: none;
}
.leaderboard__avatar img,
.leaderboard__avatar svg { width: 100%; height: 100%; object-fit: cover; }

.leaderboard__name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
  min-width: 0;
}
.leaderboard__points {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-deep);
}

/* === Kid edit form === */
.kid-edit-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0 24px;
}
.kid-edit-avatar__img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel-2);
  border: 3px solid var(--accent-2);
  box-shadow: var(--glow);
}
.kid-edit-avatar__img img,
.kid-edit-avatar__img svg { width: 100%; height: 100%; object-fit: cover; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.gender-select {
  display: flex;
  gap: 10px;
}
.gender-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all .15s;
}
.gender-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}
.gender-btn:active { transform: scale(0.97); }

.adjust-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.adjust-input { flex: 1; }
.adjust-btn { flex: none; min-width: 72px; }

.btn-sm {
  padding: 8px 14px !important;
  font-size: 13px !important;
}

/* admin kids list row */
.admin-kid-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.admin-kid-row:last-child { border-bottom: none; }
.admin-kid-row:active { background: var(--panel-2); }
.admin-kid-row__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel-2);
  flex: none;
}
.admin-kid-row__avatar img,
.admin-kid-row__avatar svg { width: 100%; height: 100%; object-fit: cover; }
.admin-kid-row__body { flex: 1; min-width: 0; }
.admin-kid-row__title {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-1);
  display: flex; align-items: center; gap: 6px;
}
.admin-kid-row__sub {
  font-size: 13px;
  color: var(--ink-3);
}
.admin-kid-row__points {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-deep);
}
.admin-row__arrow {
  color: var(--ink-4);
  font-size: 20px;
  font-weight: 300;
}

.admin-add-kid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 12px;
  transition: background .15s;
}
.admin-add-kid:active { background: var(--accent-soft); }
