:root {
  --blue: #2d6fff;
  --blue-press: #1f57d6;
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --line: #e2e2e7;
  --danger: #d7263d;
  --ok: #1a9d55;
  --warn: #b8860b;
  --radius: 14px;
  --tap: 48px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--card); border-bottom: 1px solid var(--line);
  padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; }
#main { padding: 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; border: 1px solid var(--line); }
.loading { text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* Big primary actions */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.big-btn {
  min-height: 96px; border: none; border-radius: var(--radius); background: var(--blue); color: #fff;
  font-size: 19px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer;
}
.big-btn .ico { font-size: 30px; }
.big-btn:active { background: var(--blue-press); }
.big-btn.secondary { background: #e9eef9; color: var(--blue); }
.big-btn.recording { background: var(--danger); }

button, .btn {
  min-height: var(--tap); font-size: 17px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); padding: 0 18px; cursor: pointer;
}
button:active { opacity: .85; }
.btn-primary { background: var(--blue); color: #fff; border: none; font-weight: 600; }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > * { flex: 1 1 auto; }
.full { width: 100%; }

textarea, input[type=text], input[type=time], input[type=date], select {
  width: 100%; min-height: var(--tap); font-size: 17px; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--text); -webkit-appearance: none; margin-top: 6px;
}
textarea { min-height: 76px; resize: vertical; }
label { font-size: 14px; color: var(--muted); font-weight: 600; }
.field { margin-bottom: 12px; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 6px 8px; font-weight: 700; }

/* member chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--line);
  background: #fff; color: var(--text); font-size: 16px; display: inline-flex; align-items: center;
}
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }

/* lists */
.evt { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.evt:last-child { border-bottom: none; }
.evt .when { min-width: 64px; text-align: center; color: var(--blue); font-weight: 700; font-size: 13px; }
.evt .title { font-weight: 600; }
.evt .meta { color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 12px; background: #eef; color: var(--blue); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }

.warn { background: #fff8e6; border: 1px solid #f0d98a; color: #7a5b00; border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.danger-note { background: #fdeaec; border: 1px solid #f2b8bf; color: #8a1020; border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.assume { color: var(--muted); font-size: 14px; margin: 6px 0; }
.status { text-align: center; color: var(--muted); padding: 10px; }
.spinner { display:inline-block; width:18px; height:18px; border:3px solid #cfd8ef; border-top-color: var(--blue); border-radius:50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge { font-size: 12px; background: var(--danger); color:#fff; padding: 3px 9px; border-radius: 10px; }
.muted { color: var(--muted); }
.summary { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.center { text-align:center; }
.code-display { font-size: 40px; letter-spacing: 8px; font-weight: 700; text-align:center; color: var(--blue); margin: 12px 0; }
a { color: var(--blue); }
