:root {
      --sage: #4a7c59;
      --sage-light: #e8f0eb;
      --sage-mid: #a8c5b0;
      --warm: #c17f3a;
      --warm-light: #f5ead8;
      --warm-mid: #e8c48a;
      --cream: #faf7f2;
      --cream-dark: #f0ebe0;
      --ink: #1a1a18;
      --ink-mid: #4a4a42;
      --ink-soft: #8a8a7a;
      --red: #c0392b;
      --red-light: #fdeaea;
      --border: #e0dbd0;
      --card: #ffffff;
      --radius: 16px;
      --radius-sm: 10px;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent
    }

    body {
      font-family: 'DM Sans', sans-serif;
      background: var(--cream);
      color: var(--ink);
      min-height: 100vh;
      max-width: 430px;
      margin: 0 auto;
      overflow-x: hidden
    }

    .page {
      display: none;
      flex-direction: column;
      min-height: 100vh;
      animation: fadeIn .25s ease
    }

    .page.active {
      display: flex
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(6px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    .topbar {
      position: sticky;
      top: 0;
      z-index: 10;
      background: var(--cream);
      border-bottom: 1px solid var(--border);
      padding: 14px 20px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between
    }

    .logo {
      font-family: 'Fraunces', serif;
      font-size: 17px;
      font-weight: 400;
      color: var(--sage)
    }

    .content {
      flex: 1;
      padding: 20px 16px 100px;
      display: flex;
      flex-direction: column;
      gap: 14px
    }

    .navbar {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 100%;
      max-width: 430px;
      background: var(--card);
      border-top: 1px solid var(--border);
      display: flex;
      z-index: 100;
      padding-bottom: env(safe-area-inset-bottom)
    }

    .nav-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      padding: 10px 4px 8px;
      background: none;
      border: none;
      cursor: pointer;
      color: var(--ink-soft);
      font-size: 10px;
      font-family: 'DM Sans', sans-serif;
      transition: color .15s
    }

    .nav-item.active {
      color: var(--sage)
    }

    .nav-item svg {
      width: 20px;
      height: 20px
    }

    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px
    }

    .card-accent {
      border-left: 3px solid var(--sage)
    }

    .card-warm {
      background: var(--warm-light);
      border-color: var(--warm-mid)
    }

    .btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 13px 20px;
      border-radius: var(--radius-sm);
      font-size: 14px;
      font-weight: 500;
      font-family: 'DM Sans', sans-serif;
      border: none;
      cursor: pointer;
      transition: all .15s;
      width: 100%;
      text-decoration: none
    }

    .btn:active {
      transform: scale(.98)
    }

    .btn-primary {
      background: var(--sage);
      color: #fff
    }

    .btn-secondary {
      background: var(--sage-light);
      color: var(--sage);
      border: 1px solid var(--sage-mid)
    }

    .btn-outline {
      background: transparent;
      color: var(--sage);
      border: 1px solid var(--sage)
    }

    .btn-ghost {
      background: transparent;
      color: var(--ink-mid);
      border: 1px solid var(--border)
    }

    .btn-sm {
      padding: 7px 14px;
      font-size: 12px;
      width: auto;
      border-radius: 8px
    }

    .field {
      display: flex;
      flex-direction: column;
      gap: 5px
    }

    .field label {
      font-size: 12px;
      font-weight: 500;
      color: var(--ink-mid)
    }

    .field input,
    .field select {
      background: var(--cream-dark);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 12px 14px;
      font-size: 14px;
      font-family: 'DM Sans', sans-serif;
      color: var(--ink);
      outline: none;
      transition: border-color .15s;
      width: 100%
    }

    .field input:focus {
      border-color: var(--sage);
      background: #fff
    }

    .badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 10px;
      border-radius: 99px;
      font-size: 11px;
      font-weight: 500
    }

    .badge-green {
      background: var(--sage-light);
      color: var(--sage)
    }

    .badge-amber {
      background: var(--warm-light);
      color: var(--warm)
    }

    .badge-red {
      background: var(--red-light);
      color: var(--red)
    }

    .progress-track {
      height: 6px;
      background: var(--cream-dark);
      border-radius: 99px;
      overflow: hidden
    }

    .progress-fill {
      height: 100%;
      background: var(--sage);
      border-radius: 99px;
      transition: width .4s ease
    }

    .month-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 6px
    }

    .mdot {
      aspect-ratio: 1;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 500;
      background: var(--cream-dark);
      color: var(--ink-soft);
      border: 1.5px solid transparent
    }

    .mdot.done {
      background: var(--sage);
      color: #fff
    }

    .mdot.current {
      background: #fff;
      color: var(--sage);
      border-color: var(--sage)
    }

    .task-list {
      display: flex;
      flex-direction: column
    }

    .task-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 0;
      border-bottom: 1px solid var(--cream-dark)
    }

    .task-row:last-child {
      border-bottom: none
    }

    .task-check {
      width: 20px;
      height: 20px;
      border-radius: 50%;
      border: 1.5px solid var(--border);
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all .2s
    }

    .task-check.done {
      background: var(--sage);
      border-color: var(--sage)
    }

    .task-check.done::after {
      content: '';
      width: 8px;
      height: 5px;
      border-left: 2px solid #fff;
      border-bottom: 2px solid #fff;
      transform: rotate(-45deg) translateY(-1px);
      display: block
    }

    .task-label {
      flex: 1;
      font-size: 13px
    }

    .task-label.done {
      color: var(--ink-soft);
      text-decoration: line-through
    }

    .alert {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      padding: 12px 14px;
      border-radius: var(--radius-sm);
      font-size: 13px;
      line-height: 1.5
    }

    .alert-warn {
      background: var(--warm-light);
      border: 1px solid var(--warm-mid);
      color: #7a4e1a
    }

    .alert-info {
      background: var(--sage-light);
      border: 1px solid var(--sage-mid);
      color: #2d5c3a
    }

    .rec-btn {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      background: var(--red);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 0 0 8px var(--red-light);
      transition: all .2s
    }

    .rec-btn:active {
      transform: scale(.95)
    }

    .rec-btn .inner {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: #fff;
      transition: border-radius .2s
    }

    .rec-btn.recording {
      background: #a93226;
      box-shadow: 0 0 0 8px rgba(192, 57, 43, .15), 0 0 0 16px rgba(192, 57, 43, .07)
    }

    .rec-btn.recording .inner {
      border-radius: 5px;
      width: 22px;
      height: 22px
    }

    .rec-timer {
      font-family: 'Fraunces', serif;
      font-size: 36px;
      font-weight: 300;
      color: var(--ink);
      letter-spacing: 2px
    }

    .waveform {
      display: flex;
      align-items: center;
      gap: 3px;
      height: 28px
    }

    .wbar {
      width: 3px;
      border-radius: 99px;
      background: var(--sage)
    }

    .wbar.active {
      animation: wv .7s ease-in-out infinite
    }

    @keyframes wv {

      0%,
      100% {
        transform: scaleY(.3)
      }

      50% {
        transform: scaleY(1)
      }
    }

    .wbar:nth-child(1) {
      height: 8px;
      animation-delay: 0s
    }

    .wbar:nth-child(2) {
      height: 18px;
      animation-delay: .12s
    }

    .wbar:nth-child(3) {
      height: 24px;
      animation-delay: .07s
    }

    .wbar:nth-child(4) {
      height: 14px;
      animation-delay: .19s
    }

    .wbar:nth-child(5) {
      height: 20px;
      animation-delay: .04s
    }

    .wbar:nth-child(6) {
      height: 10px;
      animation-delay: .15s
    }

    .wbar:nth-child(7) {
      height: 22px;
      animation-delay: .09s
    }

    .form-tab-bar {
      display: flex;
      gap: 6px;
      flex-wrap: wrap
    }

    .form-tab {
      padding: 6px 14px;
      border-radius: 99px;
      font-size: 12px;
      font-weight: 500;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--ink-soft);
      cursor: pointer;
      transition: all .15s
    }

    .form-tab.active {
      background: var(--sage);
      color: #fff;
      border-color: var(--sage)
    }

    .article-card {
      display: flex;
      gap: 12px;
      align-items: flex-start
    }

    .article-icon {
      width: 44px;
      height: 44px;
      border-radius: var(--radius-sm);
      flex-shrink: 0;
      background: var(--sage-light);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px
    }

    .section-label {
      font-size: 11px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: .08em;
      color: var(--ink-soft);
      margin-bottom: 4px
    }

    .divider {
      height: 1px;
      background: var(--border);
      margin: 2px 0
    }

    .small {
      font-size: 12px;
      color: var(--ink-soft)
    }

    .muted {
      color: var(--ink-soft)
    }

    .login-hero {
      padding: 40px 24px 20px;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px
    }

    .login-icon {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      background: var(--sage-light);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 32px;
      margin-bottom: 6px
    }

    h1 {
      font-family: 'Fraunces', serif;
      font-weight: 400;
      font-size: 24px;
      line-height: 1.2
    }

    h2 {
      font-family: 'Fraunces', serif;
      font-weight: 300;
      font-size: 19px
    }

    h3 {
      font-size: 15px;
      font-weight: 500
    }

    .instr-list {
      display: flex;
      flex-direction: column;
      gap: 10px
    }

    .instr-item {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      font-size: 13px;
      line-height: 1.5
    }

    .instr-num {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      flex-shrink: 0;
      background: var(--sage-light);
      color: var(--sage);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 500;
      margin-top: 1px
    }

    .instr-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      flex-shrink: 0;
      background: var(--warm);
      margin-top: 7px
    }

    .part-card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 12px 14px
    }

    .part-card.alerta {
      border-left: 3px solid var(--red)
    }

    .part-card.ok {
      border-left: 3px solid var(--sage)
    }

    .task-dot {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px
    }

    .task-dot.done {
      background: var(--sage-light);
      color: var(--sage)
    }

    .task-dot.pending {
      background: var(--red-light);
      color: var(--red)
    }

    .task-dot.optional {
      background: var(--cream-dark);
      color: var(--ink-soft)
    }

    #toast {
      position: fixed;
      bottom: 80px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      background: var(--ink);
      color: #fff;
      padding: 10px 20px;
      border-radius: 99px;
      font-size: 13px;
      opacity: 0;
      transition: all .3s;
      z-index: 999;
      white-space: nowrap;
      pointer-events: none
    }

    #toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0)
    }

    .hip-scroll {
      font-size: 12px;
      color: var(--ink-mid);
      line-height: 1.7;
      max-height: 200px;
      overflow-y: auto;
      padding-right: 4px
    }

    .hip-scroll p {
      margin-bottom: 8px
    }

    .consent-block {
      border-radius: var(--radius-sm);
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px
    }

    .consent-block.mama {
      background: var(--sage-light)
    }

    .consent-block.papa {
      background: var(--cream-dark)
    }

    .consent-block.rep {
      border: 1px dashed var(--border)
    }

    .sig-canvas {
      display: block;
      width: 100%;
      height: 110px;
      background: #fff;
      border: 1.5px dashed var(--border);
      border-radius: var(--radius-sm);
      touch-action: none;
      cursor: crosshair
    }

    .sig-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 4px
    }