*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: Heebo, Arial, sans-serif;
  background: #f4f9f6;
  color: #1a2e22;
  font-size: 16px;
  line-height: 1.45;
}

.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px calc(28px + env(safe-area-inset-bottom, 0px));
}

h1 {
  font-size: 32px;
  font-weight: 900;
  color: #1b5e3a;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  font-weight: 800;
  color: #1b5e3a;
  margin-bottom: 6px;
}

.muted, .date, .sub { color: #4a7a5a; }

.sub { margin: 6px 0 22px; }

.date { margin: 6px 0 18px; font-size: 16px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card {
  background: #fff;
  border: 1.5px solid #d4eadb;
  border-radius: 16px;
  padding: 18px 16px;
}

.login { padding-top: 12vh; }

label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid #d4eadb;
  border-radius: 12px;
  background: #fff;
  color: #1a2e22;
  font-family: inherit;
  font-size: 16px;
}

input:focus {
  outline: 2px solid #1b5e3a;
  border-color: #1b5e3a;
}

button { font-family: inherit; font-size: 16px; cursor: pointer; }

button[type="submit"] {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  background: #1b5e3a;
  color: #fff;
  font-weight: 800;
}

button[type="submit"]:disabled { opacity: 0.6; cursor: wait; }

.text-btn {
  min-height: 48px;
  padding: 8px 2px;
  border: 0;
  background: none;
  color: #4a7a5a;
  font-weight: 700;
}

.error {
  min-height: 1.4em;
  margin-top: 10px;
  color: #b42318;
  font-weight: 700;
}

input, select, textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid #d4eadb;
  border-radius: 12px;
  background: #fff;
  color: #1a2e22;
  font-family: inherit;
  font-size: 16px;
}

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid #1b5e3a;
  border-color: #1b5e3a;
}

.top h1, .page-title { margin: 0; }

.page-title { margin-bottom: 12px; overflow-wrap: anywhere; }

a { color: #1b5e3a; }

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: #1b5e3a;
  color: #fff;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.primary:disabled { opacity: 0.6; cursor: wait; }

.add { margin: 14px 0; }

.stack > * + * { margin-top: 12px; }

.section { margin-top: 22px; }

.field { margin-top: 16px; }

.label { display: block; font-weight: 700; margin-bottom: 8px; }

.meta { color: #4a7a5a; margin-top: 4px; }

.count { font-weight: 800; margin-top: 8px; }

.hint { color: #4a7a5a; font-size: 14px; margin-top: 6px; }

.warn { color: #b42318; font-weight: 700; }

.mark { font-weight: 400; }

.group-card, .child-row {
  display: block;
  text-decoration: none;
  color: inherit;
}

.group-card h2 { margin-bottom: 2px; }

.group-card:active, .child-row:active { background: #e7f5ec; }

.child-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.child-row strong { font-size: 18px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.plain { list-style: none; }

.plain li {
  padding: 10px 0;
  border-bottom: 1px solid #d4eadb;
  font-weight: 700;
}

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice button {
  min-height: 52px;
  border: 1.5px solid #d4eadb;
  border-radius: 12px;
  background: #fff;
  color: #1a2e22;
  font-weight: 800;
}

.choice button[aria-pressed="true"] {
  background: #1b5e3a;
  border-color: #1b5e3a;
  color: #fff;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 8px;
  padding: 8px 14px;
  border: 1.5px solid #d4eadb;
  border-radius: 12px;
  background: #fff;
  font-weight: 700;
}

.check input {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  accent-color: #1b5e3a;
}

.slot-row, .slot-edit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d4eadb;
}

.slot-day { grid-column: 1 / -1; font-weight: 800; }

.slot-row label, .slot-edit label { margin-bottom: 0; }

.new-slot { margin-top: 8px; }

.quiet-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: #4a7a5a;
  font-weight: 700;
  text-align: right;
}

.quiet-btn.danger { color: #b42318; }

.text-btn { text-decoration: none; }

.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #f4f9f6;
  border-top: 1px solid #d4eadb;
}

.nav-inner {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 720px;
}

.nav a {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 12px;
  color: #1b5e3a;
  font-weight: 800;
  text-decoration: none;
}

.nav a[aria-current="page"] { background: #1b5e3a; color: #fff; }

body.has-nav .wrap { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }

.toast {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: #1b5e3a;
  color: #fff;
  font-weight: 700;
}

.toast.bad { background: #b42318; }

@media (min-width: 700px) {
  .choice.balls { grid-template-columns: repeat(4, 1fr); }
  .slot-row, .slot-edit { grid-template-columns: 1.3fr 1fr 0.8fr auto; align-items: end; }
  .slot-day { grid-column: auto; }
}

@media (min-width: 800px) {
  .wrap { padding-top: 48px; }
  .login { padding-top: 16vh; }
}
