/* =============================================================================
   styles.css — shared styling for the parent + staff portals.
   Inline styles are NOT used so the CSP can stay tight (no `style-src
   'unsafe-inline'`-required exceptions on script-bearing pages).
   ============================================================================= */

:root {
  --omsc-green:  #064e3b;
  --omsc-mid:    #065f46;
  --omsc-soft:   #ecfdf5;
  --omsc-text:   #1f2937;
  --omsc-muted:  #6b7280;
  --omsc-error:  #b91c1c;
  --omsc-border: #d1d5db;
  --omsc-bg:     #fafafa;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--omsc-bg);
  color: var(--omsc-text);
  line-height: 1.6;
}

main.card {
  max-width: 30rem;
  margin: 4rem auto;
  padding: 2rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

h1 {
  color: var(--omsc-green);
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

h2 {
  color: var(--omsc-mid);
  margin: 0 0 1.5rem;
  font-weight: 500;
  font-size: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

input[type="email"],
input[type="text"] {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  border: 1px solid var(--omsc-border);
  border-radius: 0.5rem;
  font-family: inherit;
}

input:focus {
  outline: 2px solid var(--omsc-mid);
  outline-offset: 2px;
}

button {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--omsc-green);
  color: white;
  cursor: pointer;
  font-family: inherit;
}

button:hover { background: var(--omsc-mid); }

button.secondary {
  background: transparent;
  color: var(--omsc-mid);
  border: 1px solid var(--omsc-border);
}

button.secondary:hover { background: var(--omsc-soft); }

button:disabled { opacity: 0.6; cursor: progress; }

.row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.row > div { min-width: 0; }
.grow { flex: 1 1 auto; }

select {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  border: 1px solid var(--omsc-border);
  border-radius: 0.5rem;
  font-family: inherit;
  background: white;
}

input[type="checkbox"] { margin-right: 0.5rem; vertical-align: middle; }
label.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 400;
  margin: 1rem 0 0;
}
label.checkbox span { flex: 1; }

hr {
  margin: 1.5rem 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
}

.payment-element {
  margin-top: 0.5rem;
  min-height: 4rem;
}

ul.children-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}
ul.children-list li {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--omsc-border);
  border-radius: 0.5rem;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
ul.children-list .child-name { font-weight: 600; }
ul.children-list .child-status {
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--omsc-soft);
  color: var(--omsc-mid);
  white-space: nowrap;
}
ul.children-list .child-status.late { background: #fef3c7; color: #92400e; }
ul.children-list .child-status.charged { background: #fee2e2; color: #991b1b; }
ul.children-list .child-status.returned { background: #dbeafe; color: #1e40af; }

/* --- Staff console -------------------------------------------------------- */

main.card.wide { max-width: 60rem; }

.filters {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.filters select { width: auto; padding: 0.45rem 0.6rem; }
.filters input[type="search"] {
  flex: 1 1 14rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.95rem;
  border: 1px solid var(--omsc-border);
  border-radius: 0.5rem;
  font-family: inherit;
}
.filters button { margin-top: 0; padding: 0.5rem 0.9rem; }

details.child-detail {
  border: 1px solid var(--omsc-border);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  background: white;
}
details.child-detail[open] { background: #fafafa; }
details.child-detail summary {
  cursor: pointer;
  list-style: none;
  padding: 0.7rem 0.85rem;
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.4fr) minmax(8rem, 0.9fr) auto auto;
  gap: 0.6rem;
  align-items: center;
}
details.child-detail summary::-webkit-details-marker { display: none; }
details.child-detail summary::after {
  content: "▸";
  margin-left: 0.4rem;
  color: var(--omsc-muted);
  transition: transform 0.15s ease;
}
details.child-detail[open] summary::after { content: "▾"; }
details.child-detail .child-name { font-weight: 600; }
details.child-detail .parent-email { font-size: 0.9rem; }
details.child-detail .card-info { font-size: 0.85rem; }
details.child-detail .amount { font-weight: 600; color: var(--omsc-mid); }

.status-badge {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--omsc-soft);
  color: var(--omsc-mid);
  white-space: nowrap;
  text-align: center;
}
.status-badge.late     { background: #fef3c7; color: #92400e; }
.status-badge.charged  { background: #fee2e2; color: #991b1b; }
.status-badge.returned { background: #dbeafe; color: #1e40af; }

details.child-detail .detail-body {
  padding: 0.75rem 0.85rem 1rem;
  border-top: 1px solid var(--omsc-border);
}
details.child-detail h4 {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
}
details.child-detail ul.contacts {
  list-style: none;
  padding: 0;
  margin: 0;
}
details.child-detail ul.contacts li {
  padding: 0.4rem 0;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 0.9rem;
}
details.child-detail ul.contacts li:last-child { border-bottom: 0; }
details.child-detail .contact-notes {
  margin-top: 0.2rem;
  white-space: pre-wrap;
  color: var(--omsc-muted);
  font-size: 0.85rem;
}
details.child-detail textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.7rem;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--omsc-border);
  border-radius: 0.5rem;
  resize: vertical;
}
details.child-detail .save-late-status { font-size: 0.85rem; }

details.child-detail .charge-row { margin-top: 1rem; }
details.child-detail button.charge-btn {
  margin-top: 0;
  background: #b45309;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
}
details.child-detail button.charge-btn:hover { background: #92400e; }
details.child-detail button.charge-btn:disabled { background: #d97706; }
details.child-detail .charge-status { font-size: 0.85rem; }
details.child-detail .small { font-size: 0.85rem; margin-top: 0.5rem; }

/* Staff-guide status table */
table.status-table {
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
}
table.status-table th,
table.status-table td {
  border: 1px solid var(--omsc-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
table.status-table th {
  background: var(--omsc-soft);
  color: var(--omsc-mid);
  font-weight: 600;
}

@media (max-width: 50rem) {
  details.child-detail summary {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name   amount"
      "parent badge"
      "card   .";
  }
  details.child-detail .child-name    { grid-area: name; }
  details.child-detail .parent-email  { grid-area: parent; }
  details.child-detail .card-info     { grid-area: card; }
  details.child-detail .status-badge  { grid-area: badge; justify-self: end; }
  details.child-detail .amount        { grid-area: amount; justify-self: end; }
}

.error {
  color: var(--omsc-error);
  margin-top: 0.75rem;
}

footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: var(--omsc-muted);
}

.muted { color: var(--omsc-muted); }
