:root {
  color-scheme: light;
  --ink: #17342f;
  --muted: #5d716d;
  --line: #d8e3df;
  --surface: #ffffff;
  --canvas: #f0f6f3;
  --primary: #075b4c;
  --primary-strong: #03483c;
  --mint: #d9f4e8;
  --danger: #a52a2a;
  --danger-soft: #fff0ef;
  --warning: #b26a00;
  --shadow: 0 14px 34px rgba(21, 68, 57, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top right, #d9f4e8, transparent 35%), var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
.hidden { display: none !important; }

.app-header { display: flex; align-items: center; gap: .8rem; padding: calc(1rem + env(safe-area-inset-top)) 1rem 1rem; max-width: 760px; margin: 0 auto; }
.app-header h1 { margin: 0; font-size: 1.3rem; letter-spacing: -.02em; }
.brand-mark { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--primary); color: white; font-weight: 800; box-shadow: var(--shadow); }
.eyebrow, .step-label { margin: 0 0 .15rem; color: var(--primary); font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.app-header .button { margin-left: auto; width: auto; }

main { max-width: 680px; margin: 0 auto; padding: .25rem 1rem 3rem; }
.banner { padding: .85rem 1rem; border-radius: 14px; margin-bottom: 1rem; font-size: .86rem; }
.banner-info { background: #e1eef7; color: #244e69; border: 1px solid #bed7e7; }
.banner-warning { background: #fff4dc; color: #7c4c00; border-color: #f2d394; }
.card { background: var(--surface); border: 1px solid rgba(7, 91, 76, .11); border-radius: 22px; padding: 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.auth-card { max-width: 480px; margin: 1.5rem auto; }
.onboarding-guide { margin: 0 0 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: #f7fbf9; }
.onboarding-guide summary { cursor: pointer; color: var(--primary); font-weight: 800; }
.onboarding-guide p { margin: .75rem 0 .5rem; }
.onboarding-guide ol { margin: .5rem 0 0; padding-left: 1.25rem; }
.onboarding-guide li + li { margin-top: .35rem; }
.stack { display: grid; gap: .95rem; }
.stack.compact { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
label { display: grid; gap: .42rem; color: var(--ink); font-size: .86rem; font-weight: 700; }
input, select { width: 100%; padding: .82rem .9rem; border: 1px solid #bacbc6; border-radius: 12px; background: white; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(7, 91, 76, .13); }
.hint { color: var(--muted); font-weight: 400; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 13px; background: #e8f0ed; margin-bottom: 1.2rem; }
.segment { border: 0; border-radius: 10px; padding: .72rem; background: transparent; color: var(--muted); font-weight: 700; }
.segment.active { background: white; color: var(--primary); box-shadow: 0 2px 8px rgba(7, 91, 76, .1); }
.button { width: 100%; border: 0; border-radius: 13px; padding: .86rem 1rem; font-weight: 800; transition: transform .12s ease, background .12s ease; }
.button:active:not(:disabled) { transform: scale(.985); }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-strong); }
.button-secondary { background: var(--mint); color: var(--primary-strong); }
.button-danger { background: var(--danger); color: white; }
.button-ghost { background: rgba(255,255,255,.65); color: var(--primary); border: 1px solid var(--line); }
.button-outline-danger { color: var(--danger); background: white; border: 1px solid #d8a7a2; }
.text-button { border: 0; background: transparent; color: var(--primary); font-weight: 800; padding: .4rem; }
.message { min-height: 1.2em; margin: .8rem 0 0; color: var(--muted); font-size: .84rem; }
.message.error { color: var(--danger); }
.message.success { color: var(--primary); }

.account-row { display: flex; justify-content: space-between; align-items: center; padding: .2rem .25rem .8rem; color: var(--muted); font-size: .84rem; }
.app-navigation { position: sticky; top: .5rem; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; margin: 0 0 1rem; padding: .35rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(247, 251, 249, .96); box-shadow: 0 8px 24px rgba(7, 91, 76, .1); backdrop-filter: blur(12px); }
.nav-button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 800; cursor: pointer; }
.nav-button.active { background: var(--primary); color: white; }
.nav-button.tracking-live::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: .4rem; border-radius: 50%; background: #35d39a; box-shadow: 0 0 0 3px rgba(53, 211, 154, .2); }
.view-panel { min-height: 22rem; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading h2, .danger-zone h2 { margin: 0; font-size: 1.1rem; }
.badge { flex: none; padding: .35rem .55rem; border-radius: 999px; background: #edf1f0; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.badge.good { background: var(--mint); color: var(--primary); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.consent-text { color: #344d48; line-height: 1.55; font-size: .9rem; }
.check-row { display: grid; grid-template-columns: 22px 1fr; align-items: start; margin: 1rem 0; line-height: 1.4; }
.check-row input { width: 18px; height: 18px; margin: 1px 0 0; }

.status-orb-wrap { display: flex; align-items: center; gap: .9rem; background: #f3f7f5; border-radius: 16px; padding: .9rem; }
.status-orb { width: 16px; height: 16px; border-radius: 50%; background: #91a29e; box-shadow: 0 0 0 6px rgba(145,162,158,.14); }
.status-orb.active { background: #13a178; box-shadow: 0 0 0 6px rgba(19,161,120,.14); animation: pulse 1.8s infinite; }
.status-orb.error { background: var(--danger); box-shadow: 0 0 0 6px rgba(165,42,42,.12); }
.status-orb-wrap p { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(19,161,120,.04); } }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1rem 0; }
.metrics div { background: #f7f9f8; border: 1px solid #e7eeeb; border-radius: 13px; padding: .75rem; }
.metrics dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.metrics dd { margin: .3rem 0 0; font-weight: 800; font-size: .88rem; }
.action-grid { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.danger-zone { background: #fffbfa; border-color: #efd4d0; }
.danger-zone h3 { margin: 0 0 .4rem; font-size: .96rem; }
.danger-zone p { color: #72514d; font-size: .86rem; line-height: 1.5; }
.section-divider { border: 0; border-top: 1px solid #efd4d0; margin: 1.1rem 0; }
footer { max-width: 680px; margin: 0 auto; padding: 0 1rem calc(1.5rem + env(safe-area-inset-bottom)); color: var(--muted); font-size: .75rem; text-align: center; }

@media (max-width: 600px) {
  #app-view { padding-bottom: 5.25rem; }
  .app-navigation { position: fixed; top: auto; right: max(.75rem, env(safe-area-inset-right)); bottom: max(.65rem, env(safe-area-inset-bottom)); left: max(.75rem, env(safe-area-inset-left)); margin: 0; }
  footer { padding-bottom: 6rem; }
}

@media (max-width: 430px) {
  .metrics, .action-grid { grid-template-columns: 1fr; }
  .app-header { align-items: center; }
}
