:root {
  --ink: #12191c;
  --muted: #637176;
  --line: #dce4e5;
  --soft: #f2f6f6;
  --paper: #ffffff;
  --teal: #087f86;
  --teal-dark: #055a60;
  --blue: #2468d8;
  --red: #ba3030;
  --amber: #a36100;
  --green: #2c754f;
  --bottom: calc(82px + env(safe-area-inset-bottom));
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-width: 300px; background: var(--paper); }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; padding-bottom: var(--bottom); }
.loading-view { min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.brand-mark { width: 72px; height: 72px; display: grid; place-items: center; background: var(--ink); color: white; font-weight: 800; border-radius: 8px; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 76px; padding: calc(14px + env(safe-area-inset-top)) 18px 14px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 27px; line-height: 1.05; }
.topbar .eyebrow { margin: 0 0 3px; color: var(--teal); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.topbar-spacer { flex: 1; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font-size: 24px; }

.content { padding: 22px 18px 30px; max-width: 760px; margin: 0 auto; }
.greeting { margin: 0 0 20px; font-size: 18px; }
.hero { padding: 24px; background: var(--ink); color: white; border-radius: 8px; }
.hero-label { margin: 0 0 9px; color: #78d5d8; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.hero h2 { margin: 0; font-size: 27px; line-height: 1.1; }
.hero p { margin: 10px 0 0; color: #bdc8cc; line-height: 1.4; }

.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 22px 0; border: 1px solid var(--line); background: var(--line); }
.summary div { padding: 18px; background: white; }
.summary strong { display: block; font-size: 28px; }
.summary span { color: var(--muted); font-size: 13px; }

.section-head { display: flex; align-items: center; gap: 12px; margin: 28px 0 10px; }
.section-head h2 { margin: 0; font-size: 21px; }
.section-head button { margin-left: auto; }
.link-button { border: 0; background: none; color: var(--blue); font-weight: 750; padding: 8px 0; }

.list { border-top: 1px solid var(--line); }
.walk-row { width: 100%; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; color: var(--ink); }
.walk-date { display: grid; justify-items: center; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.walk-date strong { color: var(--ink); font-size: 21px; }
.walk-row h3 { margin: 0 0 4px; font-size: 17px; overflow-wrap: anywhere; }
.walk-row p { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.chevron { color: var(--muted); font-size: 23px; }

.status { display: inline-flex; margin-top: 8px; padding: 4px 7px; border-radius: 4px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 750; }
.status.in_progress { background: #e7f5f5; color: var(--teal-dark); }
.status.completed { background: #e8f3ec; color: var(--green); }
.status.protocol_draft { background: #fff0d6; color: var(--amber); }

.empty { padding: 30px 0; color: var(--muted); text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.primary, .secondary, .danger { min-height: 48px; border-radius: 7px; padding: 12px 17px; font-weight: 760; }
.primary { border: 1px solid var(--ink); background: var(--ink); color: white; }
.primary.teal { border-color: var(--teal); background: var(--teal); }
.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.danger { border: 1px solid #efc6c6; background: white; color: var(--red); }
.full { width: 100%; }
.button-row { display: flex; gap: 10px; margin-top: 16px; }
.button-row > * { flex: 1; }

.form { display: grid; gap: 17px; }
.field { display: grid; gap: 7px; }
.field label, .field legend { font-size: 13px; font-weight: 750; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #cbd6d8; border-radius: 7px; background: white; color: var(--ink); padding: 13px; outline: none; }
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,127,134,.12); }
fieldset.field { margin: 0; padding: 0; border: 0; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { display: flex; align-items: center; gap: 9px; min-height: 49px; padding: 11px; border: 1px solid var(--line); border-radius: 7px; }
.choice input { width: 18px; height: 18px; accent-color: var(--teal); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.4; }

.detail-head { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-head h2 { margin: 4px 0 8px; font-size: 28px; line-height: 1.12; overflow-wrap: anywhere; }
.detail-meta { color: var(--muted); line-height: 1.5; }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 20px 0 24px; }
.step { height: 5px; background: var(--line); }
.step.done { background: var(--teal); }

.info-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 18px 0; }
.info-item { padding: 14px; background: white; }
.info-item span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.info-item strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.focus-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.focus-tag { padding: 6px 8px; border-radius: 4px; background: #e7f5f5; color: var(--teal-dark); font-size: 12px; font-weight: 700; }

.entry { padding: 15px 0; border-bottom: 1px solid var(--line); }
.entry:first-child { border-top: 1px solid var(--line); }
.entry-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.entry-type { font-size: 12px; font-weight: 800; text-transform: uppercase; }
.entry-focus { color: var(--muted); font-size: 12px; }
.entry p { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.entry small { display: block; margin-top: 7px; color: var(--muted); }
.achievement { color: var(--green); }
.problem { color: var(--amber); }
.risk { color: var(--red); }
.idea { color: var(--blue); }

.protocol { margin-top: 20px; padding: 18px; border-left: 4px solid var(--teal); background: var(--soft); }
.protocol h3 { margin: 0 0 12px; }
.protocol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.protocol-grid div { padding: 12px; background: white; }
.protocol-grid strong { display: block; font-size: 22px; }
.protocol-grid span { color: var(--muted); font-size: 12px; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1fr; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); }
.nav-button { min-height: 56px; border: 0; background: transparent; color: var(--muted); font-weight: 650; }
.nav-button.active { color: var(--ink); }
.nav-button span { display: block; font-size: 20px; line-height: 1; margin-bottom: 4px; }
.toast { position: fixed; left: 18px; right: 18px; bottom: calc(var(--bottom) + 12px); z-index: 40; max-width: 600px; margin: auto; padding: 13px 16px; border-radius: 7px; background: var(--ink); color: white; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 640px) {
  .content { padding-left: 28px; padding-right: 28px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .choice-grid, .protocol-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 23px; }
  .hero h2, .detail-head h2 { font-size: 24px; }
}
