:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --text: #1f2528;
  --muted: #687076;
  --line: #ddd7cb;
  --brand: #2e6f68;
  --brand-strong: #1f554f;
  --accent: #c85d3f;
  --soft: #e8f1ed;
  --focus: #f4bd50;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button,
.file-action,
input,
select,
textarea {
  font: inherit;
}

button,
.file-action {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
}

button:hover,
.file-action:hover {
  background: var(--brand-strong);
}

button.secondary,
.file-action.secondary {
  background: #2f4d64;
}

button.secondary:hover,
.file-action.secondary:hover {
  background: #243c4f;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar h1,
.editor-head h2,
.section-head h2 {
  margin: 0;
}

.top-actions,
.form-actions,
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.automation-setting {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.automation-setting select {
  min-height: 36px;
  max-width: 230px;
}

.mode-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 0 14px;
  text-decoration: none;
}

.mode-link:hover {
  background: var(--soft);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: calc(100vh - 82px);
}

.sidebar {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #f0ece3;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.summary div {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary span {
  display: block;
  color: var(--brand);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.summary p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.date-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 8px;
}

.date-filter label {
  font-size: 13px;
}

.date-filter button {
  min-height: 38px;
}

.filter-status,
.empty-state {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.date-dot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.date-dot {
  min-height: 32px;
  padding: 5px 9px 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  display: grid;
  justify-items: center;
  gap: 2px;
  font-size: 12px;
}

.date-dot i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--brand);
  display: block;
}

.date-dot.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.record-list {
  display: grid;
  gap: 8px;
}

.record-item {
  width: 100%;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.record-select {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.record-delete {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #f0c9c2;
  border-radius: 6px;
  background: #fff7f5;
  color: #9f341f;
}

.record-delete:hover {
  border-color: #dc7b69;
  background: #ffebe6;
}

.record-item.active {
  border-color: var(--brand);
  box-shadow: inset 4px 0 0 var(--brand);
}

.record-item strong {
  display: block;
  margin-bottom: 6px;
}

.record-item span {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 20px;
}

.editor,
.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 18px;
}

.editor {
  display: grid;
  gap: 14px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: #2b3236;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  font-weight: 400;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

.ocr-tools {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto auto;
  align-items: end;
  gap: 10px;
}

.ocr-tools button {
  justify-self: start;
}

.section-head.compact {
  margin-bottom: 8px;
}

.section-head.compact h3 {
  margin: 0;
  font-size: 15px;
}

.hint-text,
.muted-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.source-note {
  margin: -6px 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.source-note.source-ok {
  color: var(--brand-strong);
}

.source-note.source-warn {
  color: #9b4a2f;
}

.ocr-preview-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.ocr-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: start;
}

.ocr-preview-card {
  margin: 0;
  width: 220px;
}

.ocr-preview-frame {
  display: grid;
  place-items: center;
  width: 220px;
  height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ocr-preview-frame img {
  max-width: 208px;
  max-height: 138px;
  object-fit: contain;
  transition: transform 0.18s ease;
}

.ocr-preview-card.rotated-right-angle .ocr-preview-frame img {
  max-width: 138px;
  max-height: 208px;
}

.ocr-preview-card figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.file-action:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.detail {
  align-self: start;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 116px);
  overflow: auto;
}

.badge {
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
}

.preview {
  display: grid;
  gap: 14px;
  line-height: 1.7;
}

.preview h3 {
  margin: 0;
  font-size: 22px;
}

.preview h4 {
  margin: 4px 0;
}

.preview p {
  margin: 0;
  white-space: pre-wrap;
}

.image-preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.image-grid figure {
  margin: 0;
}

.sortable-image {
  cursor: grab;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.sortable-image.dragging {
  cursor: grabbing;
  opacity: 0.55;
}

.sortable-image.drag-over {
  border-color: var(--focus);
  background: #fff8e5;
}

.image-grid figcaption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.reorder-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.reorder-actions button {
  min-height: 34px;
  padding: 0 8px;
  font-size: 13px;
}

.reorder-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.audio-preview {
  width: 100%;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-strong);
  font-size: 13px;
  padding: 4px 9px;
}

dialog {
  width: min(860px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.28);
}

dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-head h2 {
  margin: 0;
}

#exportText {
  font-family: Consolas, monospace;
  font-size: 12px;
}

.child-shell {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.child-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 20px;
}

.child-steps {
  display: grid;
  gap: 14px;
}

.child-step {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.child-step h2 {
  margin: 0;
  font-size: 22px;
}

.child-feedback-panel {
  display: grid;
  gap: 10px;
}

.feedback-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.feedback-card h3,
.feedback-card h4 {
  margin: 0 0 8px;
}

.feedback-card p,
.feedback-card ul {
  margin: 0;
  line-height: 1.7;
}

.feedback-card ul {
  padding-left: 20px;
}

.voice-recorder {
  display: grid;
  gap: 14px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.voice-clip-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.voice-clip-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.voice-clip-item p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.voice-segment {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.voice-segment.has-audio {
  border-color: #b7d8cf;
  background: #f4fbf8;
}

.voice-segment.text-only {
  border-color: #ead1c8;
  background: #fff8f5;
}

.voice-segment.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 124, 112, 0.14);
}

.voice-segment p {
  margin: 0;
}

.child-notice {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  width: min(520px, calc(100vw - 32px));
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid #b7d8cf;
  border-radius: 8px;
  background: #f4fbf8;
  color: var(--brand-strong);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  padding: 16px 18px;
  text-align: center;
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.14);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.child-notice.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.feedback-date {
  color: var(--muted);
  font-size: 13px;
}

.tts-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.big-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  font-size: 18px;
  font-weight: 800;
}

.status-line {
  min-height: 24px;
  color: var(--brand-strong);
  font-weight: 700;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .detail {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topbar,
  .editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .grid.two,
  .ocr-tools,
  .photo-actions,
  .summary {
    grid-template-columns: 1fr;
  }

  .ocr-preview-card,
  .ocr-preview-frame {
    width: min(100%, 220px);
  }

  .ocr-tools button {
    justify-self: stretch;
  }

  .workspace,
  .sidebar {
    padding: 14px;
  }
}
.login-shell{min-height:100vh;display:grid;place-items:center;padding:24px;background:#f7f4ee}
.login-card{width:min(420px,100%);background:#fff;border:1px solid #e5dccf;border-radius:8px;padding:28px;box-shadow:0 10px 28px rgba(44,38,30,.08)}
.login-card h1{margin:4px 0 22px;font-size:28px}
.login-card form{display:grid;gap:16px}
.login-card label{display:grid;gap:8px;font-weight:700}
.login-card input{height:44px;border:1px solid #d7cbbb;border-radius:6px;padding:0 12px;font-size:16px}
.login-card .primary{height:46px;border:0;border-radius:6px;background:#2f7d6f;color:#fff;font-weight:800;font-size:16px}
.account-card{width:min(680px,100%)}
.auth-panel{display:grid;gap:16px}
.auth-panel[hidden]{display:none!important}
.auth-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.helper-text{margin:0;color:#6f6658;line-height:1.7}
.auth-links{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}
.auth-links button{border:0;background:transparent;color:#2f7d6f;font-weight:800;padding:4px 0;cursor:pointer}
.auth-links button:hover{text-decoration:underline}
.account-info-panel{display:grid;gap:14px}
.account-info-panel label{display:grid;gap:8px;font-weight:700}
.account-info-panel input{height:42px;border:1px solid #d7cbbb;border-radius:6px;padding:0 12px;font-size:15px}
.site-footer{padding:18px 16px 24px;text-align:center;color:#7a7164;font-size:13px}
.site-footer a{color:inherit;text-decoration:none}
.site-footer a:hover{text-decoration:underline}
@media (max-width: 720px){.auth-grid{grid-template-columns:1fr}}
