:root {
  font:
    16px/1.5 system-ui,
    sans-serif;
  color: #172b40;
  background: #f5f7fa;
  --line: #c7d2df;
  --navy: #123c64;
  --blue: #1769a4;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: #155b91;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
}
button:hover,
.button:hover {
  background: #e7eff7;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
button[aria-selected="true"] {
  background: var(--navy);
  color: white;
}
.app-header {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.8rem 2rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.app-header > a {
  font-size: 1.3rem;
  font-weight: 800;
  text-decoration: none;
}
.app-header nav {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  align-items: center;
}
main {
  max-width: 1400px;
  margin: auto;
  padding: 1.5rem 2rem 5rem;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
h1 {
  font-size: 1.9rem;
  margin: 0.2rem 0 1rem;
}
h2 {
  font-size: 1.2rem;
  margin: 0 0 1rem;
}
h3 {
  font-size: 1rem;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
  margin-bottom: 1rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  padding: 1.2rem;
  margin-bottom: 1rem;
  min-width: 0;
}
.wide {
  grid-column: 1/-1;
}
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.8rem;
}
label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  padding: 0.55rem;
  border: 1px solid #8899aa;
  border-radius: 3px;
  background: white;
  color: inherit;
  margin-top: 0.25rem;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
input[type="checkbox"] {
  display: inline;
  width: auto;
  margin: 0 0.5rem 0 0;
}
select[multiple] {
  min-height: 140px;
}
small,
.muted {
  color: #586c80;
  font-size: 0.8rem;
}
small {
  display: block;
}
.row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.list-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.list-item:last-child {
  border-bottom: 0;
}
.list-item p {
  margin: 0.3rem 0;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.65rem;
  vertical-align: top;
  overflow-wrap: anywhere;
}
th {
  background: #edf2f7;
}
.badge {
  display: inline-block;
  background: #e7eef6;
  padding: 0.1rem 0.45rem;
  font-size: 0.8rem;
}
.recipients {
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  padding: 0.5rem;
}
.recipients label {
  font-weight: 400;
}
.metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.metrics strong {
  font-size: 1.5rem;
}
.metrics > div {
  padding: 1rem;
  background: #fff;
  border-left: 3px solid var(--blue);
}
#status {
  position: fixed;
  bottom: 0;
  margin: 0;
  padding: 0.7rem 2rem;
  background: var(--navy);
  color: #fff;
  width: 100%;
  min-height: 2.8rem;
  z-index: 20;
}
#status:empty {
  display: none;
}
.prose {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.report {
  max-width: 850px;
  margin: auto;
}
blockquote {
  border-left: 3px solid var(--line);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
}
dialog {
  max-width: min(95vw, 1000px);
  max-height: 90vh;
  width: 95%;
  border: 1px solid var(--line);
  padding: 1.5rem;
}
dialog::backdrop {
  background: #172b4066;
}
.question {
  padding: 1rem;
  margin: 1rem 0;
  background: white;
  border: 1px solid var(--line);
}
.question input[type="radio"] {
  display: inline;
  width: auto;
  margin-right: 0.5rem;
}
.question img {
  max-width: 100%;
  max-height: 250px;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 3px;
  overflow: auto;
}
.day {
  background: white;
  border: 1px solid var(--line);
  padding: 0.4rem;
  min-height: 100px;
  font-size: 0.8rem;
}
.calendar-topic {
  display: block;
  margin: 0.3rem 0;
  background: #e7eef6;
  padding: 0.25rem;
}
.help {
  padding: 0.7rem;
  background: #eef4f9;
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  main {
    padding: 1rem;
  }
  .app-header {
    padding: 0.7rem 1rem;
    gap: 0.7rem;
  }
  .heading {
    display: block;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .tabs button {
    flex: 1;
  }
  h1 {
    font-size: 1.5rem;
  }
}
@media print {
  body > * {
    display: none !important;
  }
  dialog[open] {
    display: block !important;
    position: static;
    border: 0;
    max-width: none;
    max-height: none;
    width: 100%;
    overflow: visible;
  }
  dialog > button {
    display: none !important;
  }
  .report {
    max-width: none;
  }
  #previewContent {
    display: block !important;
  }
}

.question-visual svg,
.question-visual img {
  max-width: 100%;
  max-height: 360px;
}
.question-visual {
  margin: 1rem 0;
}
.preschool-object-group,
.preschool-pattern-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 2rem;
}
.question-visual .preschool-choice {
  padding: 1rem;
  border: 1px solid #ccd6df;
}

@media (min-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}
