* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

html {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 26px;
  letter-spacing: -0.013em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
a {
  font: inherit;
}

button {
  border: 0;
}

/* Browsers paint their own color over a tapped box; press feedback is ours. */
* {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
  gap: 16px;
  background: var(--canvas);
}

.phone {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: var(--phone-width);
  height: var(--phone-height);
  overflow: hidden;
  border: 1px solid var(--stone-border);
  border-radius: var(--phone-radius);
  background: var(--canvas);
  box-shadow: var(--phone-shadow);
  color: var(--ink);
  transition: --accent var(--duration-enter) var(--ease-enter),
    background-color var(--duration-enter) var(--ease-enter);
}

.phone-notch {
  position: absolute;
  z-index: 40;
  top: 0;
  left: 50%;
  width: 120px;
  height: 24px;
  border-radius: 0 0 16px 16px;
  background: var(--ink);
  transform: translateX(-50%);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 22px 20px 8px;
  color: var(--ink);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-icons {
  color: var(--body);
  font-size: var(--text-caption);
  letter-spacing: 0.02em;
}

.role-switch {
  position: relative;
  z-index: 35;
  display: flex;
  flex: 0 0 auto;
  margin: 0 20px 12px;
  padding: 3px;
  border: 1px solid var(--stone-border);
  border-radius: var(--radius-pill);
  background: var(--stone);
  transition: background-color var(--duration-enter) var(--ease-enter),
    border-color var(--duration-enter) var(--ease-enter);
}

.role-switch-indicator {
  position: absolute;
  z-index: 0;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  border: 1px solid var(--stone-border);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  transform: translate3d(calc(var(--role-index, 0) * 100%), 0, 0);
  transition: transform var(--duration-enter) var(--ease-enter),
    background-color var(--duration-enter) var(--ease-enter),
    border-color var(--duration-enter) var(--ease-enter);
}

.role-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 48px;
  padding: 8px 4px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-caption);
  font-weight: 600;
  transition: color var(--duration-enter) var(--ease-enter),
    transform var(--duration-press) var(--ease-press);
}

.role-tab:hover {
  color: var(--ink);
}

.role-tab:active {
  transform: scale(0.97);
}

.role-tab.is-active {
  color: var(--accent);
}

.screen {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--canvas);
  isolation: isolate;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 20px 28px;
  background: var(--canvas);
  opacity: 0;
  pointer-events: none;
  scrollbar-width: none;
  transform: translate3d(24px, 0, 0);
  transition: opacity var(--duration-exit) var(--ease-exit),
    transform var(--duration-exit) var(--ease-exit);
}

.view::-webkit-scrollbar {
  display: none;
}

.view.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  transition-duration: var(--duration-enter);
  transition-timing-function: var(--ease-enter);
}

.view.from-left {
  transform: translate3d(-24px, 0, 0);
}

.view.from-right {
  transform: translate3d(24px, 0, 0);
}

.view.is-leaving.to-left {
  opacity: 0;
  transform: translate3d(-24px, 0, 0);
}

.view.is-leaving.to-right {
  opacity: 0;
  transform: translate3d(24px, 0, 0);
}

.view.is-detail {
  z-index: 5;
  border-left: 1px solid var(--stone-border);
  transform: translate3d(100%, 0, 0);
}

.view.is-detail.from-right {
  transform: translate3d(100%, 0, 0);
}

.view.is-detail.is-active {
  transform: translate3d(0, 0, 0);
}

.view.is-detail.is-leaving.to-right {
  transform: translate3d(100%, 0, 0);
}

.view.is-detail.is-leaving.to-left {
  transform: translate3d(-100%, 0, 0);
}

.view.is-behind {
  opacity: 0.08;
  pointer-events: none;
  transform: scale(0.98);
}

.view-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 58px;
}

.view-header-copy {
  min-width: 0;
}

.view-subtitle,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.02em;
}

.view-title {
  margin: 3px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-heading);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.view-title.small-title {
  font-size: var(--text-section);
  line-height: 28px;
}

.view-copy {
  margin: 0;
  color: var(--body);
  font-size: var(--text-body);
  line-height: 26px;
}

.view-copy.muted-copy {
  color: var(--muted);
  font-size: var(--text-small);
  line-height: 23px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.section-label {
  margin: 0;
  color: var(--body);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-meta {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 500;
}

.surface-card {
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border: 1px solid var(--stone-border);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: var(--text-section);
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter),
    color var(--duration-enter) var(--ease-enter),
    border-color var(--duration-enter) var(--ease-enter);
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-button:active,
.primary-button:active,
.secondary-button:active,
.event-chip:active,
.dictate-button:active,
.nav-item:active,
.patient-card-main:active,
.quick-confirm:active,
.faq-question:active {
  transform: scale(0.97);
}

.icon-button svg,
.nav-icon svg,
.event-icon svg,
.mic-icon svg,
.detail-chevron svg,
.arrow-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.back-button {
  margin-top: 4px;
}

.back-button .arrow-icon {
  transform: rotate(180deg);
  transition: transform var(--duration-enter) var(--ease-enter);
}

.back-button:hover .arrow-icon {
  transform: rotate(180deg) translateX(2px);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: var(--radius-cta);
  cursor: pointer;
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 22px;
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter),
    color var(--duration-enter) var(--ease-enter),
    border-color var(--duration-enter) var(--ease-enter);
}

.primary-button {
  background: var(--grad-primary);
  color: var(--on-primary);
}

.primary-button:hover {
  filter: brightness(1.06);
}

.secondary-button {
  border: 1px solid var(--stone-border);
  background: var(--stone);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--nurse);
  background: var(--sand);
}

.accent-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 56px;
  color: var(--accent);
  cursor: pointer;
  font-size: var(--text-small);
  font-weight: 600;
  text-decoration: none;
}

.accent-link:hover {
  color: var(--ink);
}

.empty-state-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  max-width: 100%;
  padding: 10px 18px;
  border-radius: 32px;
  background: var(--sand);
  color: var(--ink);
  cursor: pointer;
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 22px;
  white-space: nowrap;
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter);
}

.empty-state-link:hover {
  background: var(--white);
  color: var(--ink);
}

.empty-state-link:active {
  transform: scale(0.97);
}

.empty-state-link .icon-svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform var(--duration-enter) var(--ease-enter);
}

.empty-state-link:hover .icon-svg {
  transform: translateX(3px);
}

.home-intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 2px;
}

.home-intro .view-title {
  font-size: var(--text-display);
  line-height: 46px;
}

.shift-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.shift-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 68px;
  padding: 12px 12px 10px;
  border-radius: var(--radius-card);
  background: var(--stone);
}

.shift-stat strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 500;
  line-height: 28px;
}

.shift-stat span {
  color: var(--body);
  font-size: var(--text-caption);
  line-height: 16px;
}

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

.patient-card {
  display: flex;
  align-items: stretch;
  min-height: 84px;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
  overflow: hidden;
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter),
    opacity var(--duration-exit) var(--ease-exit);
}

.patient-card.is-confirming,
.patient-card.is-collapsing {
  pointer-events: none;
}

.patient-card.is-collapsing {
  max-height: 0;
  min-height: 0;
  margin-top: -5px;
  margin-bottom: -5px;
  opacity: 0;
  transform: translate3d(20px, 0, 0) scale(0.96);
  transition: max-height var(--duration-exit) var(--ease-exit),
    min-height var(--duration-exit) var(--ease-exit),
    margin var(--duration-exit) var(--ease-exit),
    opacity var(--duration-exit) var(--ease-exit),
    transform var(--duration-exit) var(--ease-exit);
}

.patient-card-main {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 12px;
  min-height: 84px;
  padding: 14px 8px 14px 14px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--duration-enter) var(--ease-enter);
}

.patient-card-main:hover {
  background: var(--sand);
}

.patient-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 500;
}

.patient-info {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.patient-name {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 23px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-meta {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 17px;
}

.patient-side {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  padding: 10px 10px 10px 4px;
}

.patient-side .arrow-icon {
  color: var(--muted);
  transition: transform var(--duration-enter) var(--ease-enter),
    color var(--duration-enter) var(--ease-enter);
}

.patient-card-main:hover .patient-side .arrow-icon {
  color: var(--accent);
  transform: translateX(3px);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: var(--radius-badge);
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
}

.badge-critical {
  background: var(--critical-soft);
  color: var(--alert-text);
}

.badge-pending {
  background: var(--stone);
  color: var(--body);
}

.badge-ready {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-neutral {
  background: var(--sand);
  color: var(--body);
}

.quick-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  min-height: 56px;
  padding: 6px 14px;
  border-radius: var(--radius-cta);
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 16px;
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter),
    color var(--duration-enter) var(--ease-enter);
}

.quick-confirm:hover {
  background: var(--primary-container-hover);
}

.quick-confirm.is-done {
  background: var(--accent-soft);
  color: var(--accent);
}

.detail-view {
  padding-top: 8px;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--accent-soft);
  transition: background-color var(--duration-enter) var(--ease-enter);
}

.detail-hero .patient-avatar {
  width: 54px;
  height: 54px;
  background: var(--white);
}

.detail-hero-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.detail-name {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.02em;
}

.detail-room {
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.detail-status {
  align-self: flex-start;
  margin-top: 4px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-section-title {
  margin: 0;
  color: var(--body);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clinical-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
}

.clinical-value {
  display: inline-block;
  width: fit-content;
  color: var(--alert-text);
  cursor: pointer;
  filter: blur(5px);
  font-family: var(--font-display);
  font-size: var(--text-small);
  line-height: 23px;
  user-select: none;
  transition: filter var(--duration-enter) var(--ease-enter);
}

.clinical-value.is-revealed {
  filter: blur(0);
}

.reveal-button {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  min-height: 56px;
  padding: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: var(--text-small);
  font-weight: 600;
}

.reveal-button:hover {
  color: var(--ink);
}

.reveal-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform var(--duration-enter) var(--ease-enter);
}

.reveal-button.is-revealed svg {
  transform: rotate(180deg);
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  background: var(--sand);
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.privacy-note svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  fill: none;
  stroke: var(--charcoal);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
  overflow: hidden;
}

.detail-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 16px;
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.detail-list-row + .detail-list-row {
  border-top: 1px solid var(--stone);
}

.detail-list-row strong {
  color: var(--ink);
  font-weight: 600;
}

.detail-chevron {
  display: inline-flex;
  color: var(--muted);
  transition: transform var(--duration-enter) var(--ease-enter), color var(--duration-enter) var(--ease-enter);
}

.detail-chevron.is-expanded {
  color: var(--accent);
  transform: rotate(90deg);
}

.pending-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--sand);
}

.pending-summary-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-summary strong {
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 500;
  line-height: 28px;
}

.pending-summary span {
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.pending-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 500;
  line-height: 28px;
}

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

.task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
  transition: transform var(--duration-press) var(--ease-press),
    max-height var(--duration-exit) var(--ease-exit),
    min-height var(--duration-exit) var(--ease-exit),
    margin var(--duration-exit) var(--ease-exit),
    padding var(--duration-exit) var(--ease-exit),
    opacity var(--duration-exit) var(--ease-exit);
}

.task-card:hover {
  background: var(--sand);
}

.task-card.is-confirming {
  background: var(--accent-soft);
}

.task-card.is-collapsing {
  max-height: 0;
  min-height: 0;
  margin-top: -5px;
  margin-bottom: -5px;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(22px, 0, 0) scale(0.96);
}

.task-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--stone);
  color: var(--charcoal);
}

.task-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.task-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.task-time {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 16px;
}

.task-title {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 23px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-note {
  overflow: hidden;
  color: var(--body);
  font-size: var(--text-caption);
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter),
    color var(--duration-enter) var(--ease-enter);
}

.task-action:disabled {
  cursor: default;
}

.confirm-mark {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.confirm-mark path {
  stroke-dasharray: 32;
  stroke-dashoffset: 0;
  opacity: 0.35;
}

.task-card.is-confirming .confirm-mark path,
.patient-card.is-confirming .confirm-mark path {
  animation: check-draw var(--duration-enter) var(--ease-enter) forwards;
  opacity: 1;
}

.confirm-label {
  display: none;
  color: var(--accent);
  font-size: var(--text-caption);
  font-weight: 600;
  white-space: nowrap;
}

.task-card.is-confirming .confirm-label,
.patient-card.is-confirming .confirm-label {
  display: inline;
}

.task-card.is-confirming .task-action,
.patient-card.is-confirming .quick-confirm {
  background: var(--accent-soft);
  color: var(--accent);
  pointer-events: none;
}

.empty-state {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px 44px;
  text-align: center;
}

.empty-state h2 {
  max-width: 280px;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 280px;
  margin: 0;
  color: var(--body);
  font-size: var(--text-small);
  line-height: 23px;
}

.completion-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--patient);
  color: var(--white);
}

.completion-mark svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  animation: check-draw var(--duration-enter) var(--ease-enter) forwards;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: 32%;
  left: 50%;
  width: 7px;
  height: 14px;
  border-radius: 2px;
  background: var(--sky);
  opacity: 0;
  transform: translate3d(0, 0, 0) rotate(0deg);
  animation: confetti-fall var(--duration-burst) var(--ease-exit) forwards;
  animation-delay: var(--confetti-delay);
}

.confetti-piece:nth-child(2n) { background: var(--sun); }
.confetti-piece:nth-child(3n) { background: var(--coral); }
.confetti-piece:nth-child(4n) { background: var(--family); }
.confetti-piece:nth-child(1) { --confetti-x: -112px; --confetti-y: -118px; }
.confetti-piece:nth-child(2) { --confetti-x: -84px; --confetti-y: -148px; }
.confetti-piece:nth-child(3) { --confetti-x: -52px; --confetti-y: -164px; }
.confetti-piece:nth-child(4) { --confetti-x: -22px; --confetti-y: -170px; }
.confetti-piece:nth-child(5) { --confetti-x: 16px; --confetti-y: -164px; }
.confetti-piece:nth-child(6) { --confetti-x: 52px; --confetti-y: -148px; }
.confetti-piece:nth-child(7) { --confetti-x: 86px; --confetti-y: -118px; }
.confetti-piece:nth-child(8) { --confetti-x: 112px; --confetti-y: -84px; }
.confetti-piece:nth-child(9) { --confetti-x: -124px; --confetti-y: -58px; }
.confetti-piece:nth-child(10) { --confetti-x: 126px; --confetti-y: -46px; }
.confetti-piece:nth-child(11) { --confetti-x: -72px; --confetti-y: 24px; }
.confetti-piece:nth-child(12) { --confetti-x: 74px; --confetti-y: 28px; }

.registration-layer {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
}

.registration-layer.is-open {
  pointer-events: auto;
  visibility: visible;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--veil-ink);
  opacity: 0;
  transition: opacity var(--duration-exit) var(--ease-exit);
}

.registration-layer.is-open .sheet-backdrop {
  opacity: 1;
}

.registration-sheet {
  position: relative;
  display: flex;
  width: 100%;
  max-height: 82%;
  flex-direction: column;
  gap: 14px;
  padding: 10px 20px 20px;
  border-radius: 24px 24px 0 0;
  background: var(--white);
  color: var(--ink);
  transform: translate3d(0, calc(100% + 20px), 0);
  transition: transform var(--duration-enter) var(--ease-enter);
}

.registration-layer.is-open .registration-sheet {
  transform: translate3d(0, var(--drag-y, 0px), 0);
}

.sheet-handle {
  position: relative;
  width: 42px;
  height: 4px;
  margin: 0 auto 4px;
  border-radius: var(--radius-pill);
  background: var(--stone-border);
  cursor: grab;
}

.sheet-handle::after {
  position: absolute;
  inset: -14px -40px;
  content: "";
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.02em;
}

.sheet-copy {
  margin: 0;
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.quick-events {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.event-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--stone-border);
  border-radius: var(--radius-card);
  background: var(--sand);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter),
    border-color var(--duration-enter) var(--ease-enter);
}

.event-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.event-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--white);
  color: var(--accent);
}

.event-chip strong,
.event-chip small {
  display: block;
}

.event-chip strong {
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 20px;
}

.event-chip small {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 16px;
}

.dictate-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px 16px;
  border-radius: var(--radius-cta);
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  text-align: left;
  transition: transform var(--duration-press) var(--ease-press),
    background-color var(--duration-enter) var(--ease-enter);
}

.mic-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
}

.dictate-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.dictate-copy strong {
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 23px;
}

.dictate-copy small {
  color: var(--on-ink-soft);
  font-size: var(--text-caption);
  line-height: 16px;
}

.tray-feedback {
  min-height: 22px;
  margin: -2px 0 0;
  color: var(--accent);
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 22px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity var(--duration-enter) var(--ease-enter), transform var(--duration-enter) var(--ease-enter);
}

.tray-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

.patient-intro .view-title {
  font-size: var(--text-section);
  line-height: 28px;
}

.onboarding-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onboarding-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.onboarding-intro p {
  margin: 0;
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.onboarding-card {
  display: flex;
  min-height: 170px;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
}

.onboarding-card:nth-child(2) {
  background: var(--sand);
}

.onboarding-card-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.onboarding-card-copy strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 500;
  line-height: 22px;
}

.onboarding-card-copy span {
  color: var(--body);
  font-size: var(--text-caption);
  line-height: 16px;
}

.onboarding-card .video-slot {
  width: 100%;
  max-width: 120px;
  height: auto;
  aspect-ratio: 1;
  min-height: 0;
  flex: 0 0 auto;
  align-self: center;
}

.video-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  flex: 1;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.video-slot .loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  opacity: 1;
  transition: opacity var(--duration-exit) var(--ease-exit);
}

.video-slot .loop.is-hidden {
  opacity: 0;
}

.video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-enter) var(--ease-enter);
}

.video-fallback.is-visible {
  opacity: 1;
}

.video-fallback img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.onboarding-card .video-fallback img {
  width: 120px;
  height: 120px;
}

.empty-state .video-fallback img {
  width: 160px;
  height: 160px;
}

.empty-state .video-slot {
  width: 160px;
  height: 160px;
  min-height: 160px;
  flex: 0 0 160px;
}

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 2px 0;
}

.timeline-time,
.task-time,
.shift-stat strong,
.pending-count,
.status-time,
.clinical-value {
  font-variant-numeric: tabular-nums;
}

.timeline-time,
.task-time,
.time-nowrap {
  white-space: nowrap;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  min-height: 72px;
  padding: 10px 0 14px 18px;
  border-left: 2px solid var(--stone-border);
}

.timeline-item:last-child {
  min-height: 58px;
  padding-bottom: 8px;
}

.timeline-item::before {
  position: absolute;
  top: 17px;
  left: -6px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--canvas);
  border-radius: 50%;
  background: var(--patient);
  content: "";
}

.timeline-item.is-pending::before {
  background: var(--muted);
}

.timeline-time {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 20px;
}

.timeline-text {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-body);
  line-height: 25px;
}

.timeline-item.is-pending .timeline-text {
  color: var(--body);
}

.next-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--patient-soft);
}

.next-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  color: var(--patient-text);
}

.next-card-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.next-card-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.next-card-copy strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 23px;
}

.next-card-copy span {
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--text-small);
  font-weight: 500;
  line-height: 22px;
}

.faq-question:hover {
  background: var(--sand);
}

.faq-question .detail-chevron {
  transition: transform var(--duration-enter) var(--ease-enter), color var(--duration-enter) var(--ease-enter);
}

.faq-item.is-open .faq-question .detail-chevron {
  color: var(--accent);
  transform: rotate(90deg);
}

.faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  padding: 0 16px;
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
  transition: grid-template-rows var(--duration-enter) var(--ease-enter), padding var(--duration-enter) var(--ease-enter);
}

.faq-answer > div {
  min-height: 0;
  overflow: hidden;
}

.faq-item.is-open .faq-answer {
  grid-template-rows: 1fr;
  padding-top: 0;
  padding-bottom: 14px;
}

.family-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--family-soft);
}

.family-summary strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-lead);
  font-weight: 500;
  line-height: 25px;
}

.family-summary span {
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.visit-card,
.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
}

.visit-icon,
.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--family-soft);
  color: var(--family-text);
}

.contact-icon {
  background: var(--nurse-soft);
  color: var(--nurse-text);
}

.visit-icon svg,
.contact-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.visit-copy,
.contact-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.visit-copy strong,
.contact-copy strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 23px;
}

.visit-copy span,
.contact-copy span {
  color: var(--body);
  font-size: var(--text-small);
  line-height: 22px;
}

.contact-actions {
  display: flex;
  gap: 8px;
}

.contact-actions .primary-button,
.contact-actions .secondary-button {
  flex: 1;
  min-height: 56px;
  padding: 8px 10px;
  font-size: var(--text-caption);
}

.bottom-nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  flex: 0 0 var(--nav-height);
  min-height: var(--nav-height);
  border-top: 1px solid var(--stone-border);
  background: var(--white);
}

.nav-item {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 15px;
  transition: color var(--duration-enter) var(--ease-enter),
    transform var(--duration-press) var(--ease-press);
}

.nav-item:hover {
  color: var(--ink);
}

.nav-item.is-active {
  color: var(--accent);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  transition: transform var(--duration-enter) var(--ease-enter);
}

.nav-item.is-active .nav-icon {
  transform: translateY(-2px);
}

.splash-layer {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
  opacity: 1;
  transition: opacity var(--duration-exit) var(--ease-exit), visibility var(--duration-exit) var(--ease-exit);
}

.splash-layer.is-leaving {
  visibility: hidden;
  opacity: 0;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}

.splash-mascot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  border-radius: 0;
  background: transparent;
}

.splash-mascot .video-slot {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.splash-mascot .video-fallback img {
  width: 180px;
  height: 180px;
}

.splash-wordmark {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 500;
  line-height: 48px;
  letter-spacing: -0.02em;
  animation: card-in var(--duration-enter) var(--ease-enter) both;
}

.splash-tagline {
  max-width: 220px;
  margin: 0;
  color: var(--body);
  font-size: var(--text-small);
  line-height: 23px;
  animation: card-in var(--duration-enter) var(--ease-enter) calc(var(--stagger) * 2) both;
}

.splash-skip {
  min-height: 56px;
  min-width: 56px;
  margin-top: 8px;
  padding: 8px 24px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-caption);
  font-weight: 600;
  transition: color var(--duration-enter) var(--ease-enter),
    transform var(--duration-press) var(--ease-press);
}

.splash-skip:hover {
  color: var(--ink);
}

.splash-skip:active {
  transform: scale(0.97);
}

.celebration-layer {
  position: absolute;
  z-index: 45;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--veil-canvas);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-enter) var(--ease-enter);
}

.celebration-layer.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.celebration-card {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 310px;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 26px;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--stone);
  text-align: center;
  transform: translateY(18px) scale(0.96);
  transition: transform var(--duration-enter) var(--ease-enter);
}

.celebration-layer.is-visible .celebration-card {
  transform: translateY(0) scale(1);
}

.celebration-card h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 500;
  line-height: 28px;
  letter-spacing: -0.02em;
}

.celebration-card p {
  margin: 0;
  color: var(--body);
  font-size: var(--text-small);
  line-height: 23px;
}

.celebration-mascot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 126px;
  height: 126px;
  animation: mascot-pop var(--duration-enter) var(--ease-enter) both;
}

.celebration-mascot .celebration-doctor-image {
  display: block;
  width: 126px;
  height: 126px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view.is-active .patient-card,
.view.is-active .task-card,
.view.is-active .timeline-item,
.view.is-active .visit-card,
.view.is-active .contact-card,
.view.is-active .faq-item,
.view.is-active .onboarding-card-copy {
  animation: card-in var(--duration-enter) var(--ease-enter) both;
}

.view.is-active .patient-card:nth-child(1),
.view.is-active .task-card:nth-child(1),
.view.is-active .timeline-item:nth-child(1),
.view.is-active .visit-card:nth-child(1),
.view.is-active .contact-card:nth-child(1),
.view.is-active .faq-item:nth-child(1) { animation-delay: calc(var(--stagger) * 1); }
.view.is-active .patient-card:nth-child(2),
.view.is-active .task-card:nth-child(2),
.view.is-active .timeline-item:nth-child(2),
.view.is-active .visit-card:nth-child(2),
.view.is-active .contact-card:nth-child(2),
.view.is-active .faq-item:nth-child(2) { animation-delay: calc(var(--stagger) * 2); }
.view.is-active .patient-card:nth-child(3),
.view.is-active .task-card:nth-child(3),
.view.is-active .timeline-item:nth-child(3),
.view.is-active .visit-card:nth-child(3),
.view.is-active .contact-card:nth-child(3),
.view.is-active .faq-item:nth-child(3) { animation-delay: calc(var(--stagger) * 3); }
.view.is-active .patient-card:nth-child(4),
.view.is-active .task-card:nth-child(4),
.view.is-active .timeline-item:nth-child(4),
.view.is-active .visit-card:nth-child(4),
.view.is-active .contact-card:nth-child(4),
.view.is-active .faq-item:nth-child(4) { animation-delay: calc(var(--stagger) * 4); }
.view.is-active .onboarding-card:nth-child(1) .onboarding-card-copy { animation-delay: calc(var(--stagger) * 1); }
.view.is-active .onboarding-card:nth-child(2) .onboarding-card-copy { animation-delay: calc(var(--stagger) * 2); }

@keyframes check-draw {
  from { stroke-dashoffset: 32; }
  to { stroke-dashoffset: 0; }
}

@keyframes mascot-pop {
  0% { opacity: 0; transform: scale(0.7) rotate(-7deg); }
  70% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes confetti-fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--confetti-x), var(--confetti-y), 0) rotate(220deg); }
}

@keyframes number-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

.pending-count.is-updating {
  animation: number-pop var(--duration-enter) var(--ease-enter);
}

@media (max-width: 499px) {
  .stage {
    min-height: 100vh;
    padding: 0;
  }

  .phone {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .stage-hint {
    display: none;
  }

  .phone-notch {
    display: none;
  }

  .status-bar {
    padding-top: max(10px, env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }

  .view,
  .view.is-active,
  .view.is-leaving,
  .view.is-detail,
  .view.is-detail.is-active,
  .registration-sheet,
  .splash-layer,
  .celebration-layer,
  .celebration-card {
    opacity: 1;
    transform: none;
  }

  .role-switch-indicator {
    transition: none;
  }

  .video-slot .loop {
    animation: none;
  }

  .confetti-layer,
  .splash-mascot,
  .celebration-mascot {
    animation: none;
  }
}
