:root {
  --navy-900: #061a33;
  --navy-800: #0b2545;
  --navy-700: #13315c;
  --navy-600: #1d4278;
  --cyan: #00c2e0;
  --cyan-600: #00a3bf;
  --cyan-50: #e6f9fc;
  --bg: #f3f6fa;
  --card: #ffffff;
  --text: #0b1b33;
  --muted: #5b6b80;
  --line: #dfe6ef;
  --ok: #12a36a; --ok-bg: #e7f7ef;
  --and: #2f6fe0; --and-bg: #e9f0fd;
  --pen: #d98a00; --pen-bg: #fff4dd;
  --nao: #8a97a8; --nao-bg: #eef1f5;
  --danger: #d6344b;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(11, 37, 69, .07);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--navy-600); }
h1 { font-size: 26px; line-height: 1.2; margin: 6px 0 8px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.wrap { max-width: 820px; margin: 0 auto; padding: 16px 16px 120px; }
.muted { color: var(--muted); }
.muted-light { color: #b9cbe2; margin: 0; }
.tiny { font-size: 13px; }
.center { text-align: center; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan-600); }
.row { display: flex; align-items: center; }
.row-between { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.wrap-gap { flex-wrap: wrap; gap: 10px; }
.nolist { list-style: none; padding: 0; margin: 0; }
.nolist li { padding: 4px 0; }
.section-title { margin: 28px 0 12px; font-size: 18px; color: var(--navy-800); }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.topbar-title { flex: 1; font-weight: 700; font-size: 17px; text-align: center; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; text-decoration: none; font-size: 26px; background: rgba(255,255,255,.08);
}
.icon-btn:active { background: rgba(255,255,255,.18); }
.logo-dot { width: 44px; height: 44px; border-radius: 12px; background: radial-gradient(circle at 30% 30%, var(--cyan), var(--navy-600)); }

/* Hero */
.hero {
  background: radial-gradient(120% 140% at 100% 0%, var(--navy-600) 0%, var(--navy-800) 55%, var(--navy-900) 100%);
  color: #fff; border-radius: 22px; padding: 20px; display: flex; align-items: center; gap: 16px; justify-content: space-between;
  box-shadow: 0 10px 30px rgba(11,37,69,.25); margin-bottom: 14px;
}
.hero h1 { color: #fff; font-size: 28px; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: rgba(255,255,255,.14); }
.ring-fg { stroke: var(--cyan); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring-val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-val b { font-size: 24px; }
.ring-val span { font-size: 11px; color: #b9cbe2; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; color: var(--navy-800); }
.stat span { font-size: 12.5px; color: var(--muted); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--cyan-600), var(--cyan)); border-radius: 99px; transition: width .5s; }

/* Buttons */
.btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px; border-radius: 14px; font: inherit; font-weight: 650; font-size: 16px;
  background: var(--card); color: var(--navy-800); border: 1.5px solid var(--line); transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.btn.primary:hover { background: var(--navy-700); }
.btn.cyan { background: var(--cyan); color: var(--navy-900); border-color: var(--cyan); }
.btn.ghost { background: #fff; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.warn-btn { background: var(--pen-bg); color: #7a4d00; border-color: #f1d08e; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 14.5px; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn.block { display: flex; width: 100%; margin: 14px 0; }
.danger-txt { color: var(--danger) !important; }
.btn.rec-btn { background: #fff0f2; color: #b3132b; border-color: #f6c6ce; width: 100%; min-height: 52px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 14px 0; }
details.card > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '▾'; position: absolute; right: 18px; color: var(--muted); }
details.card { position: relative; }
details.card[open] > summary { margin-bottom: 12px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
label { display: block; font-size: 14px; font-weight: 600; color: var(--navy-800); }
input, textarea {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 16px; color: var(--text);
  background: #fbfcfe; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; resize: vertical;
}
input:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,194,224,.18); background: #fff; }
textarea { min-height: 84px; line-height: 1.45; }

/* Banner */
.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--cyan-50); border: 1.5px solid #b5ecf5; border-radius: var(--radius); padding: 14px; margin: 14px 0; font-size: 14.5px; flex-wrap: wrap; }
.banner > div:nth-child(2) { flex: 1 1 220px; }
.banner.warn { background: var(--pen-bg); border-color: #f1d08e; }
.banner-ic { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--navy-800); color: #fff; }
.banner.warn .banner-ic { background: var(--pen); }
.banner-sub { margin-top: 6px; }

/* Steps list */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step-row { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--card); border-radius: 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); border-left: 5px solid var(--nao); min-height: 64px; }
.step-row:active { transform: scale(.995); }
.step-row.st-ok { border-left-color: var(--ok); }
.step-row.st-and { border-left-color: var(--and); }
.step-row.st-pen { border-left-color: var(--pen); }
.step-num { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--navy-800); color: #fff; }
.st-ok .step-num { background: var(--ok); }
.step-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.badge { flex: none; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.badge.st-ok { background: var(--ok-bg); color: #0b7a4e; }
.badge.st-and { background: var(--and-bg); color: #1f55b8; }
.badge.st-pen { background: var(--pen-bg); color: #8a5800; }
.badge.st-nao { background: var(--nao-bg); color: #56637a; }

/* Step page */
.step-head { margin-bottom: 8px; }
.step-progress { display: flex; gap: 5px; margin: 4px 0 14px; }
.dot { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.dot.st-ok { background: var(--ok); }
.dot.st-and { background: var(--and); }
.dot.st-pen { background: var(--pen); }
.dot.cur { outline: 2px solid var(--cyan); outline-offset: 2px; }
.why { background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); color: #e8f1fb; border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.why b { color: var(--cyan); }
.why p { margin: 6px 0 0; }
.guide { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 12px 0; }
.guide > summary { cursor: pointer; font-weight: 700; color: var(--navy-800); font-size: 16.5px; }
.guide[open] > summary { margin-bottom: 12px; }
.guide-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .guide-grid { grid-template-columns: 1fr 1fr; } }
.g { border-radius: 12px; padding: 12px; border: 1px solid var(--line); }
.g h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.g p { margin: 0; font-size: 15px; }
.g1 { background: #eef6ff; } .g1 h3 { color: #1f55b8; }
.g2 { background: #f2fbfd; } .g2 h3 { color: #007f96; }
.g3 { background: #f6f4ff; } .g3 h3 { color: #5b3fc4; }
.g4 { background: #ecf9f2; } .g4 h3 { color: #0b7a4e; }

.q-card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); border: 1.5px solid transparent; }
.q-card.done { border-color: #bfe8d4; }
.q-head { display: flex; gap: 10px; align-items: flex-start; }
.q-head h3 { flex: 1; font-size: 17px; line-height: 1.35; margin: 2px 0 6px; }
.q-num { flex: none; font-size: 12.5px; font-weight: 800; color: var(--navy-800); background: var(--cyan-50); border: 1px solid #b5ecf5; border-radius: 8px; padding: 3px 7px; margin-top: 2px; }
.q-check { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line); margin-top: 3px; }
.q-card.done .q-check { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 3px #fff; }
.tip { margin: 2px 0 10px; font-size: 14.5px; }
.tip > summary { cursor: pointer; color: var(--cyan-600); font-weight: 650; }
.tip p { margin: 6px 0 0; background: #f6fafd; padding: 10px; border-radius: 10px; color: #33465f; }
.lbl { margin: 8px 0; }
.obs { margin: 8px 0; }
.obs > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--navy-600); }
.chk { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 15px; margin: 10px 0; color: var(--text); }
.chk input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--navy-800); }
.big-chk { align-items: flex-start; background: #f6fafd; padding: 12px; border-radius: 12px; }
.big-chk input { margin-top: 2px; }
.audio-box { margin-top: 10px; display: grid; gap: 10px; }
.audio-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fbfcfe; display: grid; gap: 8px; }
.audio-meta { display: flex; flex-direction: column; }
.audio-item audio { width: 100%; height: 44px; }
.rec-live { border: 2px solid #f6c6ce; background: #fff6f7; border-radius: 14px; padding: 12px; display: grid; gap: 10px; }
.rec-ind { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #b3132b; }
.rec-ind b { font-size: 26px; font-variant-numeric: tabular-nums; color: var(--text); }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: #e0213d; animation: blink 1s infinite; }
.rec-ind.paused .rec-dot { animation: none; background: var(--nao); }
@keyframes blink { 50% { opacity: .25; } }
.note { border-radius: 12px; padding: 12px; margin: 10px 0; background: #f1f5fa; font-size: 14.5px; }
.note ul { margin: 6px 0 0; padding-left: 20px; }
.note.ok { background: var(--ok-bg); }
.note.pen { background: var(--pen-bg); }
.conclude { border: 1.5px dashed #c8d5e5; }
.err { color: var(--danger); font-weight: 600; min-height: 1em; margin: 6px 0 0; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px;
  padding: 10px 12px calc(10px + var(--safe-b)); background: rgba(255,255,255,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.bottom-nav .home-btn { width: 52px; padding: 0; font-size: 22px; }
@media (min-width: 860px) { .bottom-nav { max-width: 820px; margin: 0 auto 12px; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); } }
.saved-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 14; font-size: 12.5px; color: var(--muted); background: rgba(255,255,255,.9); padding: 3px 10px; border-radius: 99px; pointer-events: none; white-space: nowrap; }
.saved-bar.pulse { color: var(--ok); }
.saved-bar:empty { display: none; }

.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.link-list li:last-child { border-bottom: 0; }
.progress-line { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0; }
.progress-line > div { height: 100%; width: 0; background: var(--cyan); transition: width .2s; }
.danger-zone { border: 1.5px solid #f4c7ce; }

/* Modal & toast */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(6,26,51,.55); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 20px 18px calc(18px + var(--safe-b)); animation: up .2s ease-out; }
@media (min-width: 640px) { .modal-wrap { align-items: center; padding: 20px; } .modal { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.modal-actions .btn { flex: 1 1 140px; }
#toasts { position: fixed; top: calc(70px + env(safe-area-inset-top, 0px)); left: 0; right: 0; z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 520px; background: var(--navy-800); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 14.5px; transition: opacity .35s, transform .35s; }
.toast.ok { background: #0b7a4e; }
.toast.warn { background: #8a5800; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(-8px); }

@media (min-width: 900px) {
  body { font-size: 16.5px; }
  .wrap { padding-top: 24px; }
  .hero { padding: 28px; }
}

.saved-in-nav { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--muted); margin: -4px 0 -2px; min-height: 16px; }
.saved-in-nav.pulse { color: var(--ok); }
