:root {
  --bg: #f4f7ff;
  --bg-accent: radial-gradient(circle at top left, rgba(96, 165, 250, 0.16), transparent 28%), radial-gradient(circle at top right, rgba(244, 114, 182, 0.14), transparent 24%), linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: #ffffff;
  --text: #183153;
  --muted: #5d7094;
  --border: rgba(135, 158, 198, 0.25);
  --primary: #3a7cf6;
  --primary-strong: #285cd3;
  --secondary: #e6efff;
  --success: #20b26b;
  --success-soft: #e8f8ef;
  --warning: #f2b233;
  --warning-soft: #fff5db;
  --danger: #ef6b6b;
  --danger-soft: #ffe8e8;
  --shadow: 0 20px 45px rgba(39, 71, 144, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-accent);
  color: var(--text);
  min-height: 100vh;
}
main [id],
#main-content { scroll-margin-top: 110px; }
body.role-child {
  --primary: #2dc3aa;
  --primary-strong: #22a18d;
  --secondary: #e7fbf7;
  --success: #38b868;
  --success-soft: #e8f8eb;
  --warning: #f3c94a;
  --warning-soft: #fff6d8;
  --danger: #ff7a6f;
  --danger-soft: #ffe5e2;
  --text: #17345c;
  --muted: #65799b;
  --border: rgba(147, 176, 220, 0.24);
  --bg-accent: radial-gradient(circle at top left, rgba(94, 234, 212, 0.24), transparent 28%), radial-gradient(circle at bottom right, rgba(255, 211, 132, 0.18), transparent 24%), linear-gradient(180deg, #f8fbff 0%, #f7f1ff 48%, #f8fcff 100%);
}
body.role-parent {
  --primary: #3a7cf6;
  --primary-strong: #285cd3;
  --secondary: #e8efff;
  --text: #1b2f4d;
  --muted: #64748b;
  --border: rgba(120, 146, 192, 0.22);
  --bg-accent: radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 30%), radial-gradient(circle at top right, rgba(45, 212, 191, 0.1), transparent 26%), linear-gradient(180deg, #f7faff 0%, #eef3fb 100%);
}

a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav a:focus-visible,
.nav button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

.container { width: min(1120px, calc(100vw - 28px)); margin: 0 auto; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 0 10px;
  background: rgba(248, 251, 255, 0.96);
}
@supports (backdrop-filter: blur(18px)) {
  .topbar {
    backdrop-filter: blur(18px);
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.82), rgba(248, 251, 255, 0.48));
  }
}
.topbar .inner {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.brand-stack { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 12px 24px rgba(58, 124, 246, 0.22);
}
.brand-menu {
  position: relative;
}
.brand-menu__toggle {
  list-style: none;
  cursor: pointer;
}
.brand-menu__toggle::-webkit-details-marker { display: none; }
.brand-menu__toggle span[aria-hidden="true"] { display: grid; place-items: center; width: 100%; height: 100%; }
.brand-menu__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(230px, calc(100vw - 22px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 36px rgba(23, 52, 92, 0.2);
  display: grid;
  gap: 10px;
}
.brand-menu:not([open]) .brand-menu__panel { display: none; }
.brand-menu__panel a,
.brand-menu__logout button {
  border: 1px solid rgba(58, 124, 246, 0.14);
  background: rgba(255, 255, 255, 0.96);
  color: var(--primary-strong);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.brand-menu__logout { margin: 0; }
.brand-menu__logout button { width: 100%; cursor: pointer; }
.brand { font-weight: 800; font-size: 1rem; }
.brand-subline { margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: end; }
.header-menu { display: block; }
.mobile-menu {
  position: relative;
}
.mobile-menu__toggle {
  list-style: none;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(58, 124, 246, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  place-content: center;
  gap: 5px;
  cursor: pointer;
}
.mobile-menu__toggle::-webkit-details-marker { display: none; }
.mobile-menu__toggle span[aria-hidden="true"] {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--primary-strong);
}
.mobile-menu__toggle:hover {
  background: var(--secondary);
  border-color: rgba(58, 124, 246, 0.28);
}
.mobile-menu__label--open { display: none; }
.mobile-menu[open] .mobile-menu__toggle {
  background: var(--secondary);
}
.mobile-menu[open] .mobile-menu__label--closed { display: none; }
.mobile-menu[open] .mobile-menu__label--open { display: inline; }
.mobile-menu__toggle:focus-visible {
  background: var(--secondary);
  border-color: rgba(58, 124, 246, 0.28);
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}
.mobile-menu__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(280px, calc(100vw - 22px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 36px rgba(23, 52, 92, 0.2);
  display: grid;
  gap: 10px;
}
.mobile-menu__nav {
  display: grid;
  gap: 8px;
}
.mobile-menu__nav a,
.mobile-menu__logout button {
  border: 1px solid rgba(58, 124, 246, 0.14);
  background: rgba(255, 255, 255, 0.96);
  color: var(--primary-strong);
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.mobile-menu__nav a.active {
  background: var(--secondary);
}
.mobile-menu__nav a:focus-visible,
.mobile-menu__logout button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}
.mobile-menu__logout { margin: 0; }
.mobile-menu__logout button { width: 100%; cursor: pointer; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav a,
.nav button {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: .18s ease;
}
.nav a.active,
.nav a:hover,
.nav button:hover {
  color: var(--primary-strong);
  border-color: rgba(58, 124, 246, 0.16);
  background: var(--secondary);
  text-decoration: none;
}
.account-action { margin: 0; }
.account-action button {
  border: 1px solid rgba(58, 124, 246, 0.14);
  background: rgba(255, 255, 255, 0.96);
  color: var(--primary-strong);
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.account-action button:hover { background: var(--secondary); }
.app-main { padding: 20px 0 40px; }
.skip-link {
  position: absolute;
  left: 12px;
  top: -56px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fff;
  color: var(--primary-strong);
  box-shadow: var(--shadow);
}
.skip-link:focus { top: 12px; }

.card,
.hero-panel,
.filter-shell,
.editor-card,
.insight-card,
.feed-card,
.subject-card,
.goal-card,
.motivation-card,
.parent-child-card,
.empty-card,
.metric-card,
.summary-card,
.quote-card,
.action-card,
.mini-average-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card {
  padding: 24px;
  margin-bottom: 18px;
}
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.inline { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
label {
  display: block;
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(135, 158, 198, 0.32);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
textarea { min-height: 110px; resize: vertical; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(58, 124, 246, 0.24);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.secondary {
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(58, 124, 246, 0.14);
  box-shadow: none;
}
.btn.danger {
  background: linear-gradient(135deg, #ff8e7e, #ef5f5f);
  box-shadow: 0 14px 28px rgba(239, 95, 95, 0.22);
}
.btn.btn-compact { padding: 6px 14px; min-height: 36px; font-size: .88rem; }
form > .btn + .btn { margin-left: 8px; }
.edit-context { overflow-wrap: anywhere; }
.alert {
  padding: 14px 18px;
  border-radius: 18px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert.error { background: var(--danger-soft); color: #9d342f; border-color: rgba(239, 107, 107, 0.16); }
.alert.success { background: var(--success-soft); color: #19704a; border-color: rgba(32, 178, 107, 0.16); }
.alert.info { background: var(--secondary); color: var(--primary-strong); border-color: rgba(58, 124, 246, 0.12); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .96rem; }
th, td { padding: 14px 10px; border-bottom: 1px solid rgba(135, 158, 198, 0.16); text-align: left; }
.small, .small-label { color: var(--muted); font-size: .9rem; }
.small-label { display: block; margin-bottom: 6px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.stats-card { text-align: center; }
.stats-value { font-size: 1.7rem; font-weight: 800; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary-strong);
  font-weight: 700;
  margin-bottom: 10px;
}
.hero-copy { color: var(--muted); margin: 0; }
.hero-shell,
.section-grid,
.subject-grid,
.parent-child-grid,
.parent-stat-grid,
.trend-grid,
.filter-grid,
.subject-average-strip,
.distribution-chart { display: grid; gap: 18px; }
.hero-shell { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); margin-bottom: 22px; }
.hero-panel { padding: 28px; position: relative; overflow: hidden; }
.child-hero .hero-panel--intro {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(239, 252, 248, 0.96));
}
.parent-surface,
.parent-hero .hero-panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(242, 247, 255, 0.96));
}
.hero-panel h1,
.page-hero h1,
.section-head h2,
.subject-card h3,
.goal-card h3,
.feed-card h3,
.parent-child-card h3,
.empty-card h3,
.motivation-card h3,
.mini-average-card h2 {
  margin: 0;
  line-height: 1.15;
}
.hero-panel h1,
.page-hero h1 { font-size: clamp(2rem, 3vw, 2.8rem); margin-bottom: 10px; }
.hero-illustration {
  position: relative;
  min-height: 146px;
  margin: 22px 0 18px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(245, 252, 255, 0.76), rgba(228, 251, 244, 0.92));
  overflow: hidden;
}
.hero-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}
.hero-orb--one {
  width: 140px;
  height: 140px;
  left: 26px;
  bottom: -28px;
  background: linear-gradient(135deg, rgba(255, 159, 90, 0.82), rgba(255, 121, 111, 0.92));
}
.hero-orb--two {
  width: 110px;
  height: 110px;
  right: 24px;
  top: 16px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.72), rgba(59, 130, 246, 0.58));
}
.hero-badge {
  position: absolute;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  max-width: 140px;
  border-radius: 18px 18px 18px 6px;
  background: rgba(223, 249, 238, 0.96);
  color: #136652;
  font-weight: 700;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.summary-card { padding: 24px; }
.summary-card--highlight {
  background: linear-gradient(145deg, rgba(235, 252, 244, 0.98), rgba(230, 249, 255, 0.92));
}
.summary-score {
  font-size: clamp(2.3rem, 6vw, 3.25rem);
  font-weight: 900;
  margin: 10px 0 6px;
}
.summary-score.good { color: var(--success); }
.summary-score.steady { color: var(--warning); }
.summary-score.focus { color: var(--danger); }
.summary-hint { margin: 0; color: var(--text); }
.trend-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.trend-card {
  padding: 18px 16px;
  border-radius: 18px;
  background: var(--card-strong);
  border: 1px solid rgba(135, 158, 198, 0.16);
  text-align: center;
}
.trend-value { display: block; font-size: 1.8rem; font-weight: 800; margin-bottom: 2px; }
.trend-card--good .trend-value { color: var(--success); }
.trend-card--steady .trend-value { color: #7c8aa7; }
.trend-card--focus .trend-value { color: var(--danger); }

.section-block { margin-bottom: 22px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head.compact { margin-bottom: 14px; }
.section-head h2 { font-size: clamp(1.35rem, 2vw, 1.85rem); }
.section-head p { margin: 6px 0 0; }
.section-head--wrap { flex-wrap: wrap; }
.section-head--wrap > div { flex: 1 1 14rem; min-width: 0; }
.section-head--wrap > .btn { flex: 0 0 auto; }
.subject-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.subject-card {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 255, 0.95));
}
.subject-card .small { margin: 8px 0 0; }
.subject-card h3 { overflow-wrap: anywhere; }
.subject-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 1.2rem;
  margin-bottom: 14px;
  box-shadow: 0 12px 24px rgba(58, 124, 246, 0.16);
}
.accent-0 .subject-icon { background: linear-gradient(135deg, #ff8f7b, #ff6b6b); }
.accent-1 .subject-icon { background: linear-gradient(135deg, #5b8ff9, #4d6cff); }
.accent-2 .subject-icon { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.accent-3 .subject-icon { background: linear-gradient(135deg, #46c46f, #20b26b); }
.accent-4 .subject-icon { background: linear-gradient(135deg, #f3c94a, #f59e0b); }
.subject-meta {
  display: inline-flex;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 700;
}
.subject-meta.good,
.grade-pill.good,
.mini-average-card.good { background: var(--success-soft); color: var(--success); }
.subject-meta.steady,
.grade-pill.steady,
.mini-average-card.steady { background: var(--warning-soft); color: #c98a04; }
.subject-meta.focus,
.grade-pill.focus,
.mini-average-card.focus { background: var(--danger-soft); color: #ca5048; }
.subject-meta.neutral,
.grade-pill.neutral,
.mini-average-card.neutral { background: rgba(226, 232, 240, 0.9); color: #64748b; }

.section-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.section-grid--child { align-items: stretch; }
.insight-card { padding: 24px; }
.progress-chart svg {
  width: 100%;
  height: 220px;
  display: block;
}
.progress-chart line {
  stroke: rgba(135, 158, 198, 0.3);
  stroke-width: .6;
}
.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-labels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  gap: 10px;
  margin-top: 10px;
  font-size: .88rem;
  color: var(--muted);
}
.quote-card {
  padding: 18px 20px;
  margin-top: 16px;
  color: #b45309;
  background: linear-gradient(135deg, rgba(255, 245, 230, 0.95), rgba(255, 238, 215, 0.92));
}
.distribution-chart {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  min-height: 210px;
  padding-top: 26px;
}
.bar-group {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 8px;
}
.bar {
  width: 100%;
  max-width: 28px;
  border-radius: 14px 14px 6px 6px;
  min-height: 10px;
}
.bar-tone-good { background: linear-gradient(180deg, #79dfa4, #20b26b); }
.bar-tone-steady { background: linear-gradient(180deg, #ffe085, #f3c94a); }
.bar-tone-focus { background: linear-gradient(180deg, #ffad8e, #ff7a6f); }
.bar-tone-neutral { background: linear-gradient(180deg, #cbd5e1, #94a3b8); }
.bar-label, .bar-value { font-size: .84rem; color: var(--muted); }
.goal-stack { display: grid; gap: 14px; }
.goal-card, .motivation-card { padding: 18px 20px; }
.goal-card { background: rgba(255, 255, 255, 0.96); }
.goal-card--reached { border-left: 4px solid #20b26b; }
.goal-card--open { border-left: 4px solid #ff9d76; }
.goal-card h3 { margin: 0 0 4px; }
.goal-panel { border: 1px solid rgba(214, 223, 236, 0.9); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; background: rgba(255, 255, 255, 0.96); }
.goal-panel p { margin: 4px 0; }
.goal-panel__head { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; }
.goal-panel__line { font-weight: 600; }
.goal-panel__status span { display: block; color: var(--muted); }
.goal-panel__status--reached { color: #157a4b; }
.goal-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 10px; }
.goal-form label { flex: 1 1 100%; margin: 0; }
.goal-form input[type="text"] { flex: 1 1 120px; max-width: 200px; min-width: 0; }
.goal-form--remove { margin-top: 6px; }
.motivation-card {
  background: linear-gradient(135deg, rgba(255, 247, 214, 0.98), rgba(255, 236, 186, 0.95));
}
.motivation-card p { margin: 8px 0 0; color: #8f4d00; }

.feed-list { display: grid; gap: 14px; }
.feed-card { padding: 18px 20px; }
.feed-main {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}
.feed-card p { margin: 8px 0 0; }
.feed-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .92rem;
}
.grade-pill {
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 800;
  min-width: 62px;
  text-align: center;
}
.parent-feed-card { background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 255, 0.95)); }
.action-row { margin-top: 16px; }
.empty-card { padding: 24px; }
.empty-card p { margin: 8px 0 0; }

.page-hero,
.filter-shell,
.subject-average-strip,
.editor-card { margin-bottom: 20px; }
.page-hero {
  padding: 24px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.page-hero--child {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(231, 251, 247, 0.95));
}
.page-hero--parent {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 246, 255, 0.96));
}
.page-hero-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.metric-card {
  padding: 18px 20px;
  min-width: 120px;
  background: rgba(255, 255, 255, 0.96);
}
.metric-card strong { display: block; font-size: 1.6rem; }
.metric-card--soft { background: rgba(255, 255, 255, 0.82); }
.metric-card--accent { background: linear-gradient(145deg, rgba(231, 239, 255, 0.96), rgba(255, 255, 255, 0.96)); }
.parent-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-shell { padding: 20px; }
.filter-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.filter-grid__action { display: flex; align-items: end; }
.filter-grid__action .btn { width: 100%; }
.js-enabled .filter-apply { display: none; }
.filter-disclosure__toggle { display: none; }
.filter-disclosure__status { color: var(--muted); font-size: .88rem; font-weight: 600; }
.filter-reset {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-top: 8px;
  font-weight: 700;
}
.segmented-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
}
.segmented-link {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}
.segmented-link.active,
.segmented-link:hover {
  background: var(--card-strong);
  color: var(--primary-strong);
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(58, 124, 246, 0.12);
}
.subject-average-strip { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.mini-average-card { padding: 16px 18px; }
.mini-average-card h2 { font-size: 1rem; margin-bottom: 8px; }
.editor-card { padding: 22px; }
.editor-form { display: grid; gap: 0; }
.compact-grid { gap: 14px; }
.parent-child-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.parent-child-card {
  padding: 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.avatar-badge {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--primary-strong);
  background: var(--secondary);
}
.action-stack { display: grid; gap: 12px; }
.action-card {
  padding: 16px 18px;
  color: var(--text);
  font-weight: 700;
}
.action-card:hover { text-decoration: none; transform: translateY(-1px); }
.mobile-child-nav { display: none; }
.mobile-child-nav__inner {
  width: min(480px, calc(100vw - 22px));
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(var(--mobile-nav-columns, 3), minmax(0, 1fr));
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 30px rgba(23, 52, 92, 0.2);
}
.mobile-child-nav__link {
  min-height: 44px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  font-size: .94rem;
  font-weight: 700;
  color: var(--muted);
}
.mobile-child-nav__link.active {
  color: var(--primary-strong);
  background: var(--secondary);
}
.mobile-child-nav__link--add {
  width: min(56px, 100%);
  height: 56px;
  min-height: 56px;
  margin-top: -22px;
  justify-self: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  box-shadow: 0 14px 26px rgba(34, 161, 141, 0.35);
}
.mobile-child-nav__link:hover { text-decoration: none; }
.mobile-child-nav__link:focus-visible {
  outline: 3px solid rgba(58, 124, 246, 0.38);
  outline-offset: 2px;
}
.subject-card--link { text-decoration: none; color: inherit; cursor: pointer; }
.subject-card--link:hover { text-decoration: none; transform: translateY(-2px); }
.grade-list .grade-entry-card { min-width: 0; }
.grade-list .feed-main > div:first-child { min-width: 0; }
.grade-list .feed-main h3,
.grade-list .feed-main p,
.grade-list .feed-meta-grid { overflow-wrap: anywhere; }
.grade-list .action-row { align-items: stretch; }
.grade-list .action-row form { margin: 0; }

@media (max-width: 860px) {
  .topbar .inner { border-radius: 30px; align-items: start; }
  .header-actions { width: 100%; justify-content: stretch; }
  .nav { width: 100%; }
  .page-hero { flex-direction: column; align-items: start; }
}

@media (max-width: 680px) {
  .container { width: min(100vw - 20px, 1120px); }
  .topbar { padding: 8px 0; }
  .topbar .inner {
    min-width: 0;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 20px;
    flex-direction: row;
    align-items: center;
  }
  .brand-stack { min-width: 0; gap: 9px; }
  .brand-mark { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 13px; }
  .brand { font-size: .92rem; }
  .header-actions { display: none; }
  .header-menu { flex: 0 0 auto; margin-left: auto; }
  .mobile-menu__toggle { width: 44px; height: 44px; }
  .brand-subline { display: none; }
  .app-main { padding-top: 12px; }
  .hero-panel,
  .insight-card,
  .feed-card,
  .editor-card,
  .filter-shell,
  .card,
  .page-hero { padding: 16px; border-radius: 20px; }
  .trend-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .parent-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .trend-card { padding: 11px 8px; }
  .trend-value { font-size: 1.45rem; }
  .trend-card .small { font-size: .74rem; }
  .metric-card { min-width: 0; padding: 12px; }
  .metric-card strong { font-size: 1.4rem; }
  .subject-grid,
  .subject-average-strip,
  .parent-child-grid,
  .section-grid,
  .grid.cols-2,
  .grid.cols-4 { grid-template-columns: 1fr; }
  .subject-grid,
  .subject-average-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .subject-card { padding: 12px; border-radius: 16px; }
  .subject-icon { width: 36px; height: 36px; border-radius: 12px; margin-bottom: 8px; }
  .subject-card h3 { font-size: .98rem; overflow-wrap: anywhere; }
  .subject-card .small { font-size: .78rem; }
  .subject-meta { margin-top: 10px; padding: 7px 9px; font-size: .74rem; }
  .mini-average-card { padding: 12px; }
  .distribution-chart { min-height: 150px; padding-top: 12px; gap: 6px; }
  .bar-group { min-height: 130px; gap: 5px; }
  .insight-card { padding: 16px; }
  .progress-chart svg { height: 160px; }
  .chart-labels { grid-template-columns: repeat(auto-fit, minmax(20px, 1fr)); gap: 4px; font-size: .72rem; }
  .section-head { align-items: start; }
  .section-head > a { flex: 0 0 auto; font-size: .9rem; }
  .section-block { margin-bottom: 18px; }
  .hero-shell { gap: 10px; margin-bottom: 16px; }
  body.role-child.page-dashboard .child-hero .hero-panel--summary { order: -1; }
  body.role-parent.page-dashboard .parent-hero .hero-panel--intro { padding: 18px; }
  .parent-hero .hero-panel h1 { font-size: 1.7rem; }
  .parent-child-card { padding: 14px; }
  .parent-child-card { grid-template-columns: auto 1fr; }
  .parent-child-card .grade-pill { grid-column: 1 / -1; justify-self: start; }
  .feed-main { flex-direction: column; }
  .grade-pill { align-self: flex-start; }
  .grade-list { gap: 9px; }
  .grade-list .feed-card { padding: 13px; border-radius: 16px; }
  .grade-list .feed-main { flex-direction: row; align-items: center; gap: 8px; }
  .grade-list .feed-main h3 { font-size: 1rem; }
  .grade-list .feed-main p { margin-top: 4px; font-size: .82rem; }
  .grade-list .grade-pill { align-self: center; flex: 0 0 auto; min-width: 52px; padding: 8px 10px; font-size: 1.05rem; }
  .grade-list .feed-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; margin-top: 10px; font-size: .8rem; }
  .grade-list .grade-meta-note,
  .grade-list .grade-meta-status { grid-column: 1 / -1; }
  .grade-list .action-row { gap: 8px; margin-top: 10px; }
  .grade-list .action-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-list .action-row > *,
  .grade-list .action-row form { flex: 1 1 0; min-width: 0; }
  .grade-list .action-row .btn { width: 100%; min-height: 44px; padding: 10px 8px; font-size: .88rem; }
  .grade-list .action-row .btn.danger { color: var(--danger); background: var(--danger-soft); box-shadow: none; }
  .grade-list .grade-meta-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .filter-shell { padding: 12px; }
  .filter-disclosure__toggle {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 2px;
    cursor: pointer;
    font-weight: 800;
    list-style: none;
  }
  .filter-disclosure__toggle::-webkit-details-marker { display: none; }
  .filter-disclosure__toggle::after { content: "+"; color: var(--primary-strong); font-size: 1.25rem; }
  .filter-disclosure[open] > .filter-disclosure__toggle::after { content: "−"; }
  .filter-disclosure__body { padding-top: 10px; }
  .filter-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .filter-grid__action { align-items: stretch; }
  .filter-reset { margin-top: 4px; }
  .segmented-links { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 16px; padding: 6px; gap: 4px; }
  .segmented-link { min-height: 44px; display: flex; align-items: center; justify-content: center; padding: 8px 6px; text-align: center; font-size: .86rem; }
  .hero-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .hero-actions .btn { width: 100%; min-height: 46px; }
  form > .btn { width: 100%; min-height: 46px; }
  input, select, textarea { min-height: 48px; padding: 12px 13px; margin-bottom: 12px; font-size: 16px; }
  textarea { min-height: 100px; }
  .editor-form .grade-editor-grid { gap: 0; }
  .editor-form .grade-editor-grid > div { min-width: 0; }
  .action-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .action-row .btn { width: 100%; min-height: 46px; }
  .table-wrap { overflow: visible; }
  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .table-wrap tr { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, .7); }
  .table-wrap td { display: grid; grid-template-columns: minmax(76px, 34%) minmax(0, 1fr); gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(135, 158, 198, 0.12); overflow-wrap: anywhere; }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td .btn-compact { justify-self: start; width: auto; min-height: 44px; padding: 8px 16px; }
  form > .btn + .btn { margin: 10px 0 0; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; font-weight: 700; }
  .table-wrap caption { position: static; width: auto; height: auto; margin-bottom: 8px; overflow: visible; clip: auto; white-space: normal; }
  main [id], #main-content { scroll-margin-top: 76px; }
  body.role-child.page-dashboard .child-hero { gap: 12px; margin-bottom: 14px; }
  body.role-child.page-dashboard .child-hero .hero-panel { padding: 14px; }
  body.role-child.page-dashboard .child-hero .hero-panel h1 { font-size: clamp(1.65rem, 7vw, 2rem); }
  body.role-child.page-dashboard .child-hero .hero-copy { font-size: .95rem; }
  body.role-child.page-dashboard .child-hero .hero-illustration { display: none; }
  body.role-child.page-dashboard .child-hero .hero-actions { margin-top: 12px; }
  body.role-child.page-dashboard .child-hero .hero-actions .btn.secondary { display: none; }
  body.role-child.page-dashboard .section-block--child-recent-grades { margin-top: 8px; }
  body.role-child.has-mobile-child-nav .topbar .nav--child { display: none; }
  body.role-child.has-mobile-child-nav .app-main { padding-bottom: 118px; }
  body.role-child.has-mobile-child-nav .mobile-child-nav {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 12px;
    z-index: 30;
  }
  .mobile-child-nav__inner { width: min(480px, calc(100vw - 16px)); gap: 3px; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); }
  .mobile-child-nav__link { min-width: 0; min-height: 44px; padding: 8px 3px; font-size: .78rem; }
  .mobile-child-nav__link--add { width: 48px; height: 48px; min-height: 48px; margin-top: -17px; font-size: 1.6rem; }

  body.role-child.has-mobile-child-nav #grade-entry { scroll-margin-bottom: 132px; }
}

@media (min-width: 681px) {
  .header-menu { margin-left: 0; }
}

@media (max-width: 680px) and (hover: hover) and (pointer: fine) {
  body.role-child.has-mobile-child-nav .topbar .nav--child { display: flex; }
  body.role-child.has-mobile-child-nav .app-main { padding-bottom: 40px; }
  body.role-child.has-mobile-child-nav .mobile-child-nav { display: none; }
}

/* Notenrechner */
.calc-block { min-width: 0; }
.calc-result h2 { margin: 0 0 8px; overflow-wrap: anywhere; }
.calc-result p { margin: 6px 0; }
.calc-scope, .calc-note { overflow-wrap: anywhere; }
.calc-form input, .calc-form select { max-width: 100%; }
@media (max-width: 640px) {
  .calc-block .segmented-links { display: grid; grid-template-columns: minmax(0, 1fr); }
  .calc-block .segmented-link { text-align: center; }
}

.development-list{list-style:none;margin:0 0 .75rem;padding:0;display:grid;gap:.5rem}
.development-item{display:flex;flex-direction:column;gap:.15rem;padding:.6rem .8rem;border:1px solid #d9dee8;border-left-width:4px;border-radius:8px;background:#fff;min-width:0;overflow-wrap:anywhere}
.development-item--attention_high,.development-item--attention{border-left-color:#c58b2a}
.development-item--positive,.development-item--reached{border-left-color:#3d9a6b}
.development-child{margin:.5rem 0 .35rem;overflow-wrap:anywhere}
.development-panel{margin:.5rem 0;overflow-wrap:anywhere}
.trend-caption { margin: 10px 0 6px; overflow-wrap: anywhere; }
