:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #102033;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --border: #e2e8f0;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #e0f2fe, transparent 38%), var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding: .8rem 1rem;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 1.2rem; }
.nav { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav button {
  border: 0;
  background: #eef2ff;
  padding: .55rem .75rem;
  border-radius: 999px;
  cursor: pointer;
}
.inline-form { display: inline; }
.container { max-width: 1120px; margin: 0 auto; padding: 1rem; }
.hero, .card, .login-card, .mini-card {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.hero { padding: 1.4rem; margin-bottom: 1rem; }
.avatar { font-size: 3rem; }
h1 { margin: .2rem 0 .4rem; font-size: clamp(1.8rem, 4vw, 3rem); }
h2 { margin-top: 0; }
.muted { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: .9rem; margin: 1rem 0; }
.tile {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .35rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 20px 48px rgba(15,23,42,.11); }
.tile span { font-size: 2.3rem; }
.tile strong { font-size: 1.25rem; }
.tile small { color: var(--muted); }
.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .login-card, .mini-card { padding: 1rem; }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .65rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row.big { font-size: 1.1rem; }
.lesson { display: grid; grid-template-columns: 48px 1fr; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.lesson:last-child { border-bottom: 0; }
.lesson-num, .date-badge {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: #1d4ed8;
  font-weight: 800;
}
.date-badge { height: 58px; }
.date-badge small { display: block; font-weight: 600; color: var(--muted); }
.event-row { display: grid; grid-template-columns: 70px 1fr; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.event-row:last-child { border-bottom: 0; }
.reward { padding: .7rem; border-radius: 16px; background: #fef3c7; }
.balance { font-size: 2.4rem; font-weight: 900; color: var(--primary); margin: .5rem 0 1rem; }
.form-card label { display: block; font-weight: 700; margin-bottom: .25rem; }
.form-card input, .form-card textarea, .form-card select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: .8rem;
  background: #fff;
}
.primary {
  border: 0;
  background: var(--primary);
  color: #fff;
  padding: .8rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}
.login-card { max-width: 520px; margin: 2rem auto; padding: 1.2rem; }
.chat-box { max-height: 55vh; overflow: auto; }
.bubble { max-width: 720px; padding: .75rem .9rem; margin: .7rem 0; border-radius: 18px; background: #f1f5f9; }
.bubble.mine { margin-left: auto; background: #dbeafe; }
.bubble-head { color: var(--muted); font-size: .85rem; margin-bottom: .25rem; }
.messages { margin-bottom: 1rem; }
.message { padding: .75rem; border-radius: 16px; background: #fef3c7; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav { justify-content: flex-start; }
  .container { padding: .75rem; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 128px; }
}

/* v0.2.0 */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.hero.compact { margin-bottom: .8rem; }
.hero-action { white-space: nowrap; }
.page-head, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.page-head h1, .section-head h2 { margin: 0; }
.section-head a { color: var(--primary); font-weight: 800; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: .8rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}
.secondary { background: #eef2ff; color: #1e293b; }
.parent-tile { outline: 2px solid var(--primary-soft); }
.action-tiles .tile { min-height: 126px; }
.form-shell { max-width: 760px; margin: 0 auto; }
.field-row { margin-bottom: .95rem; }
.field-row ul.errorlist, .field-error { color: #b91c1c; font-weight: 700; margin-top: .25rem; }
.form-card input[type="checkbox"] { width: auto; transform: scale(1.15); margin-right: .4rem; }
.form-card select { min-height: 46px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .75rem; }
.stats-grid div { background: #f8fafc; border: 1px solid var(--border); border-radius: 18px; padding: .85rem; }
.stats-grid strong { display: block; font-size: 1.8rem; color: var(--primary); }
.stats-grid span { color: var(--muted); }
.card.wide { grid-column: 1 / -1; }
.footer { text-align: center; color: var(--muted); padding: 1rem 0 0; font-size: .85rem; }

@media (max-width: 760px) {
  .hero, .page-head, .section-head { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-start; }
  .primary, .secondary { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* v0.3.0 – rodinný provoz */
.child-hero {
  border-color: color-mix(in srgb, var(--profile-color, var(--primary)) 45%, var(--border));
  box-shadow: 0 18px 48px rgba(15, 23, 42, .10);
}
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}
.summary-strip div {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: .9rem;
  box-shadow: var(--shadow);
}
.summary-strip strong { display: block; font-size: 2rem; color: var(--profile-color, var(--primary)); }
.summary-strip span { color: var(--muted); }
.child-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .8rem;
  border: 1px solid var(--border);
  border-left: 6px solid var(--profile-color, var(--primary));
  border-radius: 20px;
  margin-bottom: .7rem;
  background: #fff;
}
.child-avatar { font-size: 2rem; }
.mini-actions .secondary { padding: .55rem .7rem; font-size: .9rem; }
.approval-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .65rem;
  align-items: center;
  padding: .8rem 0;
  border-bottom: 1px solid var(--border);
}
.approval-row:last-child { border-bottom: 0; }
.danger { background: #fee2e2; color: #991b1b; }
.attention-card { border-color: #fde68a; background: #fffbeb; }
.small-button { margin-top: .7rem; padding: .55rem .75rem; font-size: .9rem; }
.reward-card, .package-card { min-height: 145px; }
.checklist { padding-left: 1.2rem; }
.checklist li { margin: .45rem 0; }
.timetable-day h2 { color: var(--primary); }

@media (max-width: 760px) {
  .summary-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .child-card, .approval-row { grid-template-columns: 1fr; }
  .mini-actions { justify-content: flex-start; }
}

/* v0.4.0 – chat a zprávy */
.nav a { position: relative; }
.nav-badge, .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 .35rem;
  margin-left: .35rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
}
.chat-room-list { display: grid; gap: .85rem; }
.chat-room-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .85rem;
  align-items: center;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.chat-room-card.has-unread { border-color: #93c5fd; background: #eff6ff; }
.chat-room-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--primary-soft);
  font-size: 1.7rem;
}
.chat-room-title { display: flex; align-items: center; gap: .4rem; }
.chat-room-title strong { font-size: 1.15rem; }
.chat-room-meta { display: flex; flex-direction: column; gap: .25rem; color: var(--muted); text-align: right; font-size: .9rem; }
.small-line { font-size: .9rem; margin-top: .15rem; }
.pinned-card { border-color: #fde68a; background: #fffbeb; margin-bottom: .9rem; }
.pinned-message { padding: .7rem 0; border-bottom: 1px solid #fde68a; }
.pinned-message:last-child { border-bottom: 0; }
.pinned-bubble { outline: 2px solid #fde68a; }
.message-tools { display: flex; gap: .4rem; margin-top: .45rem; flex-wrap: wrap; }
.message-tools button {
  border: 0;
  background: rgba(255,255,255,.75);
  color: var(--muted);
  border-radius: 999px;
  padding: .35rem .55rem;
  cursor: pointer;
  font-size: .82rem;
}
.sticky-compose { position: sticky; bottom: .5rem; margin-top: .9rem; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: end; }
.chat-compose p { margin: 0; }
.chat-compose textarea { min-height: 58px; resize: vertical; }

@media (max-width: 760px) {
  .chat-room-card { grid-template-columns: auto 1fr; }
  .chat-room-meta { grid-column: 1 / -1; text-align: left; flex-direction: row; flex-wrap: wrap; }
  .chat-compose { grid-template-columns: 1fr; }
}

/* v0.5.0 – PWA / mobilní aplikace */
.install-button {
  border: 0;
  background: #dcfce7;
  color: #166534;
  padding: .55rem .75rem;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
}
.install-button[hidden] { display: none; }
.offline-card { text-align: center; }
.pwa-card ol, .steps { padding-left: 1.25rem; }
.steps li { margin: .55rem 0; }
.status-card { margin-top: 1rem; }
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  .topbar { padding-top: calc(.8rem + env(safe-area-inset-top)); }
}
@media (max-width: 760px) {
  body { -webkit-tap-highlight-color: transparent; }
  .topbar { gap: .7rem; }
  .nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; padding-bottom: .15rem; }
  .nav a, .nav button, .install-button { flex: 0 0 auto; }
}

/* v1.0.0 – stabilní rodinná verze */
.stats-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
  margin: .8rem 0 1rem;
}
.stats-inline > div {
  background: var(--primary-soft);
  border-radius: 18px;
  padding: .8rem;
}
.stats-inline small { display: block; color: var(--muted); font-weight: 700; }
.stats-inline strong { display: block; font-size: 1.15rem; margin-top: .25rem; }
.unread-row { background: #eff6ff; border-radius: 16px; padding-left: .7rem; padding-right: .7rem; }
@media (max-width: 760px) {
  .stats-inline { grid-template-columns: 1fr; }
}
