:root {
  --bg: #ecfdf5;
  --surface: #fffaf1;
  --surface-2: #e0f2f1;
  --text: #1f2a24;
  --muted: #65746d;
  --border: #c8ded6;
  --accent: #0f766e;
  --accent-dark: #0b4f49;
  --danger: #a43f35;
  --success: #2d6b45;
  --shadow: 0 16px 36px rgba(15, 66, 56, 0.14);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: linear-gradient(180deg, #f7fff9 0%, var(--bg) 100%);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}
button, input, textarea, select { font: inherit; }
button { min-height: 46px; }

.app-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 14px 14px 92px;
}

.demo-notice {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdf7;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}
.demo-notice strong { color: var(--text); }
.demo-notice a {
  display: inline-block;
  margin-left: 8px;
  color: var(--accent-dark);
  font-weight: 700;
}

.topbar {
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  align-items: center;
  gap: 8px;
  padding: env(safe-area-inset-top) 0 10px;
  text-align: center;
}
.topbar h1 { margin: 0; font-size: 28px; line-height: 1.05; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.view { display: grid; gap: 13px; }
.card, .panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, .96);
  box-shadow: var(--shadow);
  padding: 15px;
  scroll-margin-top: 14px;
}
.hero {
  background: linear-gradient(135deg, #0f766e, #173f3a);
  color: #fffaf1;
}
.hero p { color: rgba(255,250,241,.82); margin: 6px 0 0; }
.hero h2, .section-title { margin: 0; }
.hero h2 { font-size: 30px; line-height: 1.1; }
.section-title { font-size: 21px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.status-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdf7;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}
.status-line strong { color: var(--text); }

.focus-grid, .stats-grid, .quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.stat-card, .quick-button {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdf7;
  color: var(--text);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}
.stat-card strong { display: block; font-size: 24px; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.quick-button.primary { background: var(--accent); color: #fffaf1; border-color: var(--accent); }

.nav-tabs {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 250, 241, .94);
  padding: 6px;
  box-shadow: 0 10px 26px rgba(15, 66, 56, .12);
}
.nav-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.list { display: grid; gap: 10px; }
.item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}
.item h3 { margin: 0 0 4px; font-size: 19px; }
.item p { margin: 0; color: var(--muted); }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  width: max-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fffdf7;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.actions, .row-actions { display: grid; gap: 9px; }
.row-actions { grid-template-columns: 1fr 1fr; }

.primary-button, .secondary-button, .danger-button, .ghost-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  padding: 12px 14px;
}
.primary-button { background: var(--accent); color: #fffaf1; }
.secondary-button { border: 1px solid var(--border); background: #fffdf7; color: var(--text); }
.danger-button { background: var(--danger); color: #fffaf1; }
.ghost-button { background: transparent; color: var(--accent-dark); }
.is-hidden { visibility: hidden; }

.form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 800; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdf7;
  color: var(--text);
  padding: 12px 13px;
}
.field textarea { min-height: 108px; resize: vertical; }
.field textarea.big { min-height: 170px; }
.error { min-height: 16px; color: var(--danger); font-size: 13px; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fffdf7;
  cursor: pointer;
  padding: 8px 11px;
  font-weight: 800;
}
.chip.selected { background: var(--accent); color: #fffaf1; border-color: var(--accent); }

.voice-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 12px;
}
.voice-box.recording { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(164,63,53,.12); }
.voice-box audio { width: 100%; }

.floating {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 6;
}
.floating summary {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fffaf1;
  cursor: pointer;
  font-size: 30px;
  font-weight: 900;
  list-style: none;
  box-shadow: var(--shadow);
}
.floating summary::-webkit-details-marker { display: none; }
.floating-menu {
  position: absolute;
  right: 0;
  bottom: 70px;
  display: grid;
  gap: 8px;
  width: min(260px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fffaf1;
  padding: 10px;
  box-shadow: var(--shadow);
}
.floating-menu button { text-align: left; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 84px));
  z-index: 10;
  display: none;
  max-width: 520px;
  margin: 0 auto;
  border-radius: 14px;
  background: var(--success);
  color: #fffaf1;
  padding: 12px 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { display: block; }

@media (min-width: 720px) {
  .form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field.full { grid-column: 1 / -1; }
  .focus-grid, .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .actions { grid-template-columns: repeat(2, 1fr); }
}

button[disabled] { opacity: 0.55; }
