:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --text: #1b1b1b;
  --muted: #4a4f54;
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --danger: #b00020;
  --border: #c8cfc0;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --text-base: 1.125rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.75rem;
  --touch-min: 3.25rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  font-size: 18px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: var(--text-base);
  line-height: 1.6;
}

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
}

header {
  margin-bottom: 1.75rem;
}

h1 {
  margin: 0;
  font-size: var(--text-2xl);
  line-height: 1.2;
}

.subtitle {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1.45;
}

.screen.hidden,
.hidden {
  display: none !important;
}

label {
  display: block;
  font-weight: 700;
  font-size: var(--text-lg);
  margin-bottom: 0.6rem;
}

input,
select {
  width: 100%;
  font-size: var(--text-lg);
  padding: 1rem 1.1rem;
  min-height: var(--touch-min);
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 1.15rem;
}

input::placeholder {
  color: #7a8085;
}

.btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 1.05rem 1.25rem;
  min-height: var(--touch-min);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  color: white;
}

.btn.secondary {
  background: #e8efe8;
  color: var(--primary-dark);
}

.btn.record {
  background: var(--surface);
  border: 3px solid var(--primary);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 4rem;
  font-size: var(--text-xl);
}

.btn.record.active {
  background: #ffe8e8;
  border-color: var(--danger);
  color: var(--danger);
}

.btn.record .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
}

.btn.record.active .dot {
  background: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.recorder,
.processing,
.result {
  margin-top: 1.75rem;
}

.status,
.timer,
.hint,
.error {
  font-size: var(--text-lg);
  line-height: 1.5;
}

.status,
.timer {
  text-align: center;
  color: var(--muted);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 700;
}

.error {
  color: var(--danger);
  margin-top: 0.85rem;
  font-weight: 600;
}


.processing {
  text-align: center;
  padding: 2.25rem 1rem;
  font-size: var(--text-lg);
}

.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid #d8ddd2;
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.result-actions .btn.primary {
  grid-column: 1 / -1;
}

.report {
  background: var(--surface);
  border-radius: 18px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
  line-height: 1.65;
  white-space: normal;
  word-wrap: break-word;
  font-size: var(--text-lg);
}

.report p {
  margin: 0.85rem 0;
}

.report ul,
.report ol {
  margin: 0.85rem 0;
  padding-left: 1.5rem;
}

.report li {
  margin-bottom: 0.5rem;
}

.report strong {
  font-weight: 700;
}

.report h1,
.report h2,
.report h3 {
  line-height: 1.3;
}

.report h1 {
  font-size: 1.45rem;
}

.report h2 {
  font-size: 1.3rem;
  margin-top: 1.35rem;
}

.report hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 1.15rem 0;
}

#report-error {
  margin-bottom: 1.15rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.tab {
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 0.95rem 0.5rem;
  min-height: var(--touch-min);
  font-size: 1.05rem;
  font-weight: 700;
}

.tab.active {
  background: #e8efe8;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.success-box {
  margin-top: 1.75rem;
  background: #e8f5e9;
  border: 2px solid #95d5b2;
  border-radius: 16px;
  padding: 1.15rem;
  font-size: var(--text-lg);
  line-height: 1.55;
}

.hint {
  color: var(--muted);
  margin-top: 0;
}

.reports-list {
  list-style: none;
  padding: 0;
  margin: 1.15rem 0 0;
}

.report-item,
.reports-list .empty {
  width: 100%;
  text-align: left;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 1.15rem;
  margin-bottom: 0.85rem;
  font-size: var(--text-lg);
  line-height: 1.45;
}

.reports-list .empty {
  color: var(--muted);
}

.child-form,
.child-section {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 1.15rem;
  margin-bottom: 1.15rem;
}

.child-form h2,
.child-section h2 {
  margin: 0 0 1.15rem;
  font-size: 1.3rem;
}

.children-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.child-item,
.children-list .empty {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
  margin-bottom: 0.85rem;
  background: var(--bg);
}

.child-item-info {
  flex: 1;
}

.child-item-info strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: var(--text-lg);
}

.child-item-info span {
  color: var(--muted);
  font-size: var(--text-base);
}

.child-item-meta {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.5;
}

.child-action {
  width: 100%;
  min-width: 0;
  padding: 0.95rem 1rem;
  font-size: var(--text-base);
}

.children-list .empty {
  display: block;
  color: var(--muted);
  font-size: var(--text-lg);
}

/* Desktop-Berichte (#desktop-app) */

#desktop-app {
  min-height: 100vh;
  background: #eef1ea;
}

#desktop-app .desktop-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

#desktop-app .desktop-login-card {
  width: min(100%, 420px);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

#desktop-app .desktop-login-card label {
  margin-top: 1.5rem;
}

#desktop-app .desktop-login-card input {
  margin-bottom: 0;
}

#desktop-app #desktop-login-btn {
  width: 100%;
  margin-top: 1rem;
}

#desktop-app .desktop-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#desktop-app .desktop-tabs {
  display: flex;
  gap: 0.5rem;
}

#desktop-app .desktop-tab {
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#desktop-app .desktop-tab.active {
  border-color: var(--primary);
  background: #e8efe8;
  color: var(--primary-dark);
}

#desktop-app .desktop-prompt-text {
  width: 100%;
  min-height: 28rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  resize: vertical;
  margin-bottom: 1rem;
}

#desktop-app .desktop-prompt-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#desktop-app .desktop-prompt-status {
  margin: 0;
  color: var(--primary-dark);
  font-weight: 600;
}

#desktop-app .desktop-prompt-status.error {
  color: var(--danger);
}

#desktop-app .hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: #eef1ea;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

#desktop-app .desktop-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

#desktop-app .desktop-topbar h1 {
  font-size: var(--text-2xl);
}

#desktop-app .desktop-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 92px);
}

#desktop-app .desktop-sidebar {
  background: #f8faf6;
  border-right: 2px solid var(--border);
  padding: 1.25rem;
  overflow: auto;
}

#desktop-app .desktop-sidebar h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 1rem;
}

#desktop-app .desktop-reports-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#desktop-app .desktop-report-link,
#desktop-app .desktop-reports-list .empty {
  width: 100%;
  text-align: left;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
  font: inherit;
}

#desktop-app .desktop-report-link.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

#desktop-app .desktop-report-link strong {
  display: block;
  margin-bottom: 0.25rem;
}

#desktop-app .desktop-report-link span {
  color: var(--muted);
  font-size: 0.92rem;
}

#desktop-app .desktop-reports-list .empty {
  cursor: default;
  color: var(--muted);
}

#desktop-app .desktop-content {
  padding: 1.5rem;
  overflow: auto;
}

#desktop-app .desktop-empty-state {
  color: var(--muted);
  padding: 2rem 0;
}

#desktop-app .desktop-report-actions {
  margin-bottom: 1.25rem;
}

#desktop-app .desktop-report-sections {
  display: grid;
  gap: 1rem;
}

#desktop-app .desktop-section-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

#desktop-app .desktop-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: #f3f7f2;
  border-bottom: 2px solid var(--border);
}

#desktop-app .desktop-section-header h3 {
  margin: 0;
  font-size: 1rem;
  flex: 1;
  min-width: 0;
}

#desktop-app .desktop-section-copy-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

#desktop-app .desktop-section-body {
  padding: 1rem 1.1rem 1.15rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

#desktop-app .btn.copy {
  background: #edf3ef;
  color: var(--primary-dark);
  min-width: 0;
  width: auto;
  font-size: 0.85rem;
  padding: 0.55rem 0.75rem;
  white-space: nowrap;
}

#desktop-app .btn.copy.copied {
  background: #d8f0e0;
  color: #1b7a44;
}

@media (max-width: 900px) {
  #desktop-app .desktop-layout {
    grid-template-columns: 1fr;
  }

  #desktop-app .desktop-sidebar {
    border-right: none;
    border-bottom: 2px solid var(--border);
  }
}
