/* Member app prototype (/app/) */

.app-intro { padding: clamp(48px, 7vw, 88px) 0 clamp(40px, 5vw, 64px); }
.app-intro .h1 { margin-top: 18px; }

.app-stage { padding: 0 0 var(--section-y); }
.app-layout {
  display: grid; gap: clamp(32px, 5vw, 72px); align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
}
.app-layout__copy { order: 2; }
@media (min-width: 900px) {
  .app-layout { grid-template-columns: minmax(0, 1fr) 360px minmax(0, 1fr); }
  .app-layout__copy { order: 0; }
  .app-layout__phone { grid-column: 2; }
}
@media (max-width: 899px) {
  .app-layout { grid-template-columns: 1fr; }
  .app-layout__copy { order: 2; }
}
.app-notes { list-style: none; display: grid; gap: 14px; margin-top: 20px; }
.app-notes li { display: flex; gap: 12px; color: var(--mist); font-size: 15px; }
.app-notes li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); margin-top: 8px; flex: none; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; height: 680px; position: relative; overflow: hidden; }
.app__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px 12px; border-bottom: 1px solid var(--line-dark);
}
.app__brand { font-family: var(--font-display); font-weight: 900; font-stretch: 112%; font-size: 17px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.app__brand svg { width: 20px; height: 20px; }
.app__sos {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px;
  border-radius: var(--r-pill); border: 1.5px solid var(--warn); color: var(--warn); background: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.app__sos:hover { background: var(--warn); color: var(--ink); }

.app__views { flex: 1; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.view { padding: 20px 18px 28px; }
.view[hidden] { display: none; }
.view__title { font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: -.01em; margin-bottom: 4px; }
.view__title:focus { outline: none; }
.view__sub { color: var(--mist-2); font-size: 14px; margin-bottom: 18px; }
.js .view.is-entering { animation: viewIn .32s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Tab bar */
.app__tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line-dark);
  background: var(--ink); padding: 6px 4px 10px;
}
.app__tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; justify-content: center;
  background: none; border: 0; cursor: pointer; color: var(--mist-2); font-size: 11px; border-radius: 12px;
}
.app__tab svg { width: 22px; height: 22px; }
.app__tab[aria-current="page"] { color: var(--lime); }
.app__tab:hover { color: var(--paper); }

/* More sheet */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--ink-3); border-top: 1px solid var(--line-dark); border-radius: 22px 22px 0 0;
  padding: 10px 14px 18px; box-shadow: 0 -20px 40px rgba(0,0,0,.4);
  transform: translateY(100%); transition: transform .28s var(--ease); visibility: hidden;
}
.sheet.is-open { transform: none; visibility: visible; }
.sheet__grab { width: 40px; height: 4px; border-radius: 4px; background: #3A4654; margin: 0 auto 12px; }
.sheet__title { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--mist-2); padding: 0 6px 8px; }
.sheet__list { list-style: none; display: grid; gap: 4px; }
.sheet__item {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 12px;
  background: none; border: 0; border-radius: 12px; cursor: pointer; text-align: left; font-size: 16px; font-weight: 500;
}
.sheet__item:hover, .sheet__item[aria-current="page"] { background: rgba(255,255,255,.06); }
.sheet__item svg { width: 20px; height: 20px; color: var(--lime); }
.sheet-scrim { position: absolute; inset: 0; z-index: 4; background: rgba(5, 9, 13, .55); opacity: 0; transition: opacity .28s; pointer-events: none; }
.sheet-scrim.is-open { opacity: 1; pointer-events: auto; }

/* ---------- Home ---------- */
.hero-card {
  border-radius: 22px; padding: 20px; background: var(--ink); border: 1px solid var(--line-dark);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; position: relative; overflow: hidden;
}
.hero-card__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; color: var(--mist-2); }
.hero-card__status { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 13px; letter-spacing: .12em; color: var(--lime); font-weight: 500; }
.ring { width: 168px; height: 168px; margin: 8px 0 4px; position: relative; }
.ring svg { width: 100%; height: 100%; }
.ring__spin { transform-origin: 50% 50%; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ring__text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring__big { font-family: var(--font-display); font-weight: 900; font-size: 44px; line-height: 1; }
.ring__small { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; color: var(--lime); margin-top: 4px; }

.tiles { display: grid; gap: 10px; margin-top: 12px; }
.tile { background: var(--ink-3); border: 1px solid var(--line-dark); border-radius: 16px; padding: 14px 16px; }
.tile dt { font-size: 12.5px; color: var(--mist-2); }
.tile dd { margin: 2px 0 0; font-weight: 600; font-size: 16px; }
.tiles--2 { grid-template-columns: 1fr 1fr; }

.app-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px;
  border-radius: var(--r-pill); border: 0; cursor: pointer; font-weight: 600; font-size: 15.5px; margin-top: 14px;
}
.app-btn--lime { background: var(--lime); color: var(--ink); }
.app-btn--ghost { background: none; border: 1.5px solid #3A4654; color: var(--paper); }
.app-btn--warn { background: var(--warn); color: var(--ink); }

/* ---------- Shared panels ---------- */
.panel { background: var(--ink-3); border: 1px solid var(--line-dark); border-radius: 18px; padding: 16px; }
.panel + .panel { margin-top: 12px; }
.panel__h { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--mist-2); margin-bottom: 8px; }
.panel .kv > div { padding: 10px 0; }
.panel .kv dd { font-size: 14.5px; }
.panel .kv dt { font-size: 13px; }

.checklist { list-style: none; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.check { width: 22px; height: 22px; border-radius: 50%; background: var(--lime); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.check svg { width: 14px; height: 14px; }

.tracker { list-style: none; display: grid; gap: 0; margin-top: 4px; }
.tracker li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding-bottom: 14px; position: relative; font-size: 14px; }
.tracker li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: #3A4654; }
.tracker li:last-child::before { display: none; }
.tracker__dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #3A4654; background: var(--ink-2); display: flex; align-items: center; justify-content: center; }
.tracker li.is-done .tracker__dot { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.tracker li.is-done::before { background: var(--lime); }
.tracker li.is-now .tracker__dot { border-color: var(--lime); }
.tracker li.is-now .tracker__dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }
.tracker__dot svg { width: 12px; height: 12px; }
.tracker small { display: block; color: var(--mist-2); font-size: 12.5px; }

.list { list-style: none; display: grid; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-dark); font-size: 14.5px; }
.list li:last-child { border-bottom: 0; }
.list small { display: block; color: var(--mist-2); font-size: 12.5px; }

.doc-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 56px;
  background: none; border: 0; border-bottom: 1px solid var(--line-dark); cursor: pointer; text-align: left; font-size: 14.5px;
}
.doc-btn:last-child { border-bottom: 0; }
.doc-btn svg { width: 22px; height: 22px; color: var(--lime); flex: none; }
.doc-btn small { display: block; color: var(--mist-2); font-size: 12.5px; }
.toast {
  position: absolute; left: 14px; right: 14px; bottom: 84px; z-index: 6; padding: 12px 14px; border-radius: 14px;
  background: var(--paper); color: var(--ink); font-size: 13.5px; box-shadow: var(--shadow-float);
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.is-on { opacity: 1; transform: none; }

.field { display: grid; gap: 6px; margin-top: 10px; }
.field label { font-size: 12.5px; color: var(--mist-2); }
.field input, .field select {
  min-height: 46px; border-radius: 12px; border: 1.5px solid #3A4654; background: var(--ink-2); color: var(--paper);
  padding: 10px 12px; font: inherit; font-size: 15px; width: 100%;
}
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 10px;
  border: 1.5px solid #3A4654; font-size: 13.5px; cursor: pointer;
}
.seg input:checked + span { background: var(--lime); color: var(--ink); border-color: var(--lime); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--lime); outline-offset: 2px; }

.emergency { background: rgba(255, 181, 71, .12); border: 1.5px solid var(--warn); border-radius: 18px; padding: 16px; }
.emergency h3 { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--warn); }
.emergency p { font-size: 14px; margin-top: 6px; }
.emergency .list li { border-color: rgba(255, 181, 71, .25); }
.num { font-family: var(--font-mono); font-weight: 500; color: var(--paper); font-size: 15px; }

.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--lime); color: var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 900; font-size: 24px; }

/* ---------- Mobile: drop phone chrome ---------- */
@media (max-width: 599px) {
  .app-stage .phone { width: 100%; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .app-stage .phone__notch { display: none; }
  .app-stage .phone__screen { border-radius: 20px; border: 1px solid var(--line-dark); }
  .app { height: min(720px, calc(100svh - 96px)); min-height: 560px; }
  .app__bar { padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ring__spin { animation: none; }
}
