:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #1e2624;
  --muted: #6b7671;
  --brand: #2f6b5e;
  --brand-soft: #dbeae4;
  --danger: #b3453a;
  --line: #e2e7e5;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--brand); color: #fff;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.brand { font-weight: 600; letter-spacing: .2px; }
.net { font-size: 12px; color: #9edcc9; }
.net.offline { color: #ffd27f; }

main { flex: 1; overflow-y: auto; padding: 18px; padding-bottom: 96px; }
.view { display: none; }
.view.active { display: block; }
h2 { margin: 4px 0 14px; font-size: 20px; }
h3 { margin: 0 0 12px; font-size: 18px; }

/* Capture */
.capture-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 20px; min-height: 60vh;
}
.record-btn {
  width: 168px; height: 168px; border-radius: 50%;
  border: none; background: var(--brand); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 30px rgba(47,107,94,.35);
  transition: transform .1s ease;
}
.record-btn:active { transform: scale(.97); }
.record-dot { width: 54px; height: 54px; border-radius: 14px; background: #fff; transition: all .2s ease; }
.record-btn.recording { background: var(--danger); box-shadow: 0 10px 30px rgba(179,69,58,.4); animation: pulse 1.4s infinite; }
.record-btn.recording .record-dot { width: 40px; height: 40px; border-radius: 8px; }
@keyframes pulse { 0%,100% { box-shadow: 0 10px 30px rgba(179,69,58,.4);} 50% { box-shadow: 0 10px 44px rgba(179,69,58,.7);} }
.rec-timer { font-size: 34px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--danger); }
.hint { color: var(--muted); text-align: center; max-width: 260px; }
.client-chip { background: var(--brand-soft); color: var(--brand); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; }

/* Lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.card .card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card .title { font-weight: 600; }
.card .sub { color: var(--muted); font-size: 13px; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .actions { display: flex; gap: 8px; margin-top: 6px; }
.pill { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.pill.local { background: #fff2d6; color: #8a6100; }
.pill.synced { background: var(--brand-soft); color: var(--brand); }
.pill.unverified { background: #fde5e2; color: var(--danger); }
.empty { color: var(--muted); text-align: center; margin-top: 40px; }

.row-between { display: flex; justify-content: space-between; align-items: center; }
.search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; margin-bottom: 14px; background: #fff; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
label input[type=text] { display: block; width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; margin-top: 5px; color: var(--ink); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
label.check input { width: 18px; height: 18px; }

/* Buttons */
.btn { border: none; background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.linkbtn { background: none; border: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: 14px; }
.linkbtn.danger { color: var(--danger); }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--panel);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom);
}
.tab { flex: 1; padding: 14px 4px; border: none; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.tab.active { color: var(--brand); }

/* Sheets */
.sheet { position: fixed; inset: 0; background: rgba(20,30,28,.45); display: flex; align-items: flex-end; z-index: 20; }
.sheet-panel { background: var(--panel); width: 100%; border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + var(--safe-bottom)); max-height: 88vh; overflow-y: auto; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.list.compact .card { padding: 10px 14px; }

/* Toast */
.toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 40; }
