:root {
  --bg: #f5f8f8;
  --card: #ffffff;
  --ink: #1f2623;
  --muted: #6b726e;
  --line: #dfe7e8;
  --accent: #23767a;
  --accent-soft: #e2f3f0;
  --blue: #6fbde3;
  --warn: #b5452f;
  --warn-soft: #f8e6e1;
  --ok-soft: #e4f1e4;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 960px; margin: 0 auto; padding: 16px 14px 60px; }
h1 { font-size: 1.5rem; margin: 8px 0 14px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.error-text, .danger-text { color: var(--warn); }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  padding: 8px 14px; background: #fff; color: var(--ink);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.top a, .top .linklike { color: var(--accent); text-decoration: none; }
.top .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #4a4f55; margin-right: auto; font-size: 1.05rem; }
.top .brand img { width: 34px; height: 34px; }
.login-logo { display: block; width: 110px; height: 110px; margin: 4px auto 0; }
.login-title { text-align: center; color: #4a4f55; font-weight: 500; margin-top: 4px; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: .95rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px;
}
.narrow { max-width: 420px; margin: 40px auto; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.child-card, .media-card { color: inherit; text-decoration: none; margin: 0; }
.child-card:hover, .media-card:hover { border-color: var(--accent); }
.child-name { font-size: 1.15rem; font-weight: 600; margin-bottom: 4px; }
.code {
  font-size: .8rem; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  padding: 1px 7px; border-radius: 99px; vertical-align: middle; white-space: nowrap;
}
.head-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.crumbs { margin: 4px 0 10px; }
.crumbs a { text-decoration: none; }

label { display: block; margin: 0 0 10px; font-size: .9rem; color: var(--muted); }
input, select, textarea, button {
  font: inherit; color: var(--ink);
}
input:not([type=checkbox]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
button, .btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.danger { color: var(--warn); border-color: var(--warn); background: #fff; }
.delete-row { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.wide { width: 100%; }
.big { padding: 12px 22px; font-size: 1.05rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.row > input, .row > select { flex: 1 1 200px; width: auto; margin-top: 0; }
.row > label { flex: 1 1 200px; margin: 0; }
.row .short { flex: 0 1 200px; }
.between { justify-content: space-between; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); margin: 0 12px 6px 0; }
.copy { font-size: .85rem; margin-top: 6px; }

.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; background: var(--accent-soft); }
.flash.error { background: var(--warn-soft); color: var(--warn); }
.flash.ok { background: var(--ok-soft); }
.flash.info { background: #fdf6e3; }

.badge { font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: #eee; color: var(--muted); white-space: nowrap; text-decoration: none; }
.badge.achieved { background: var(--ok-soft); color: #2d6a2d; }
.badge.paused { background: var(--warn-soft); color: var(--warn); }

.file-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-pick .btn { display: block; text-align: center; padding: 14px; font-size: 1.05rem; color: #fff; }
.upload > button { margin-top: 4px; }
.up-list { list-style: none; padding: 0; margin: 10px 0 0; }
.up-list li { margin-bottom: 10px; font-size: .9rem; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 4px 0; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.bar > div.warn { background: var(--warn); }

.goals { list-style: none; padding: 0; margin: 0 0 10px; }
.goal { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.goal a.active { font-weight: 700; }
.goal select { width: auto; display: inline-block; margin: 0; padding: 4px 6px; }
.goal.achieved a { color: #2d6a2d; }
.goal.paused a { color: var(--muted); }

.thumb { position: relative; aspect-ratio: 16 / 9; background: #ddd; border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-empty { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--muted); font-size: .9rem; }
.dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: .78rem; padding: 1px 6px; border-radius: 4px; }

.viewer video, .viewer .photo { width: 100%; max-height: 65vh; background: #000; border-radius: 6px; display: block; }
.viewer .photo { object-fit: contain; }
.mark-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0; }
.meta { margin: 6px 0; }
.desc { white-space: pre-wrap; }
details.edit { margin: 8px 0; }
details summary { cursor: pointer; color: var(--accent); }

.marks, .comments, .replies, .plain { list-style: none; padding: 0; margin: 0; }
.mark { border-bottom: 1px solid var(--line); padding: 10px 0; }
.mark input { margin: 6px 0; }
.mark details .row { margin: 6px 0; }
.mark details button:not(.linklike) { padding: 4px 10px; }
.tc { font-variant-numeric: tabular-nums; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); border: 0; color: var(--accent); margin-left: 4px; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment .small .linklike { margin-right: 14px; }
.comment .text { white-space: pre-wrap; margin: 4px 0; }
.comment.role-curator > .small b { color: var(--accent); }
.replies { margin: 6px 0 0 14px; padding-left: 10px; border-left: 3px solid var(--accent-soft); }
.replies .comment:last-child { border-bottom: 0; }
.comment-form { margin-top: 12px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
td select { width: auto; display: inline-block; margin: 0; padding: 4px 6px; }
td.actions { white-space: nowrap; }
td.actions form { margin-right: 10px; }
tr.off, section.off { opacity: .6; }
.staff-pick { display: flex; flex-wrap: wrap; margin: 6px 0 10px; }

@media (max-width: 600px) {
  main { padding: 12px 10px 60px; }
  h1 { font-size: 1.3rem; }
  .top nav { font-size: .9rem; gap: 4px 10px; }
}

.clips .clip video { width: 100%; max-height: 60vh; background: #000; border-radius: 6px; display: block; margin-top: 8px; }
.clips .waiting { height: 90px; background: var(--bg); border-radius: 6px; margin-top: 8px; }
