:root {
  color-scheme: light;
  --ink: #20302b;
  --control-ink: #e2e6df;
  --control-muted: #aab4ad;
  --control-glass: rgba(33, 42, 39, 0.91);
  --control-line: rgba(255, 255, 255, 0.12);
  --accent: #87a99a;
  --shadow: 0 18px 46px rgba(22, 29, 26, 0.2);
}

* { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #c9cbc5;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
body { user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
#stage {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 48% 38%, rgba(247, 245, 237, 0.88), transparent 54%),
    linear-gradient(145deg, #d9d9d2 0%, #c8cac4 56%, #b8bcb6 100%);
}
#scene { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
#fallback {
  display: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 48% 38%, #e6e4dc, #b8bcb6);
}

.welcome-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  background: #fff;
  opacity: 1;
  transition: opacity 650ms ease;
}
.welcome-screen[hidden] { display: none; }
.welcome-screen.is-leaving { opacity: 0; pointer-events: none; }
.welcome-start {
  appearance: none;
  min-width: 150px;
  min-height: 54px;
  padding: 0 30px;
  border: 0;
  border-radius: 16px;
  color: #f8faf7;
  background: #416e5a;
  box-shadow: 0 10px 28px rgba(34, 69, 50, 0.16);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.welcome-start:hover { background: #315b48; box-shadow: 0 14px 32px rgba(34, 69, 50, 0.2); transform: translateY(-2px); }
.welcome-start:active { transform: scale(0.97); }
.welcome-start:focus-visible { outline: 3px solid #91b7a1; outline-offset: 4px; }
body.cinematic-active .scene-intro,
body.cinematic-active .interface-launcher,
body.cinematic-active .simulation-launcher,
body.cinematic-active .presentation-launcher,
body.cinematic-active .component-key,
body.cinematic-active .presentation-card,
body.cinematic-active .interface-panel,
body.cinematic-active .simulation-panel,
body.cinematic-active .interface-backdrop {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.scene-intro {
  position: fixed;
  z-index: 4;
  top: max(22px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  width: min(340px, calc(100vw - 150px));
  color: var(--ink);
  pointer-events: none;
}
.panel-label {
  display: block;
  color: #60716a;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.14em;
  line-height: 1.3;
}
.scene-intro h1 {
  margin: 5px 0 2px;
  color: #27342f;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 640;
  letter-spacing: -0.045em;
  line-height: 1.1;
}
.scene-description, .gesture-hint {
  margin: 5px 0 0;
  color: #596760;
  font-size: 12px;
  line-height: 1.45;
}
.gesture-hint { margin-top: 8px; color: #64716b; font-size: 11px; }
.scene-description, .gesture-hint { pointer-events: none; }

.lid-control {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 13px;
  padding: 0 13px;
  border: 1px solid rgba(48, 66, 58, 0.14);
  border-radius: 12px;
  color: #263b33;
  background: rgba(247, 248, 242, 0.88);
  box-shadow: 0 5px 18px rgba(36, 46, 40, 0.08);
  cursor: pointer;
  pointer-events: auto;
  font: inherit;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.lid-control:hover { background: #fffefa; border-color: rgba(48, 66, 58, 0.24); }
.lid-control[aria-pressed="true"] { color: #2f5d49; background: #e6f1e6; }
.lid-control:disabled { cursor: wait; opacity: 0.68; }
.lid-control svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lid-control span { font-size: 12px; font-weight: 650; white-space: nowrap; }

.interface-launcher {
  appearance: none;
  -webkit-appearance: none;
  position: fixed;
  z-index: 8;
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 43px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  color: #edf1ec;
  background: rgba(33, 42, 39, 0.9);
  box-shadow: 0 8px 22px rgba(22, 29, 26, 0.16);
  font: inherit;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.interface-launcher svg {
  flex: none;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.interface-launcher span { font-size: 12px; font-weight: 650; white-space: nowrap; }
.phone-launcher-badge { position: absolute; z-index: 1; top: -6px; right: -6px; display: grid; min-width: 19px; height: 19px; padding: 0 4px; place-items: center; border: 2px solid #24302a; border-radius: 99px; color: #fff; background: #d46d64; font-size: 9px !important; font-weight: 760 !important; line-height: 1; pointer-events: none; }
.phone-launcher-badge[hidden] { display: none; }
.interface-launcher:hover { background: rgba(33, 42, 39, 0.98); border-color: rgba(255,255,255,.24); }
.interface-launcher[aria-expanded="true"] { color: #25372f; background: #c5d4c8; }
.interface-launcher[aria-expanded="true"] svg { color: #25372f; }
.presentation-launcher {
  appearance: none;
  position: fixed;
  z-index: 8;
  top: max(20px, env(safe-area-inset-top));
  right: calc(max(20px, env(safe-area-inset-right)) + 165px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 43px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 14px;
  color: #2e4d3d;
  background: rgba(228, 238, 226, 0.96);
  box-shadow: 0 8px 22px rgba(22, 29, 26, 0.12);
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}
.presentation-launcher:hover { background: #f3f6ed; }
.presentation-launcher:active { transform: scale(0.96); }
.presentation-launcher svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.presentation-launcher span { font-size: 11px; font-weight: 700; white-space: nowrap; }
.presentation-launcher:focus-visible, .presentation-next:focus-visible, #presentation-exit:focus-visible,
.stock-refill:focus-visible { outline: 2px solid #648b75; outline-offset: 3px; }
.simulation-launcher {
  appearance: none;
  -webkit-appearance: none;
  position: fixed;
  z-index: 8;
  top: max(20px, env(safe-area-inset-top));
  right: calc(max(20px, env(safe-area-inset-right)) + 112px);
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  color: #edf1ec;
  background: rgba(33, 42, 39, 0.9);
  box-shadow: 0 8px 22px rgba(22, 29, 26, 0.16);
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.simulation-launcher svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.simulation-launcher:hover { background: rgba(33, 42, 39, 0.98); border-color: rgba(255,255,255,.24); }
.simulation-launcher[aria-expanded="true"] { color: #25372f; background: #c5d4c8; }
.simulation-launcher:active { transform: scale(0.96); }
.interface-launcher:focus-visible, .simulation-launcher:focus-visible, .lid-control:focus-visible, .icon-control:focus-visible,
.panel-close:focus-visible, .dose-confirm:focus-visible,
.day-picker button:focus-visible, .medication-remove:focus-visible,
.medication-submit:focus-visible, .add-medication summary:focus-visible {
  outline: 2px solid #648b75;
  outline-offset: 3px;
}

.interface-backdrop {
  appearance: none;
  position: fixed;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(32, 40, 36, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.interface-backdrop[aria-hidden="false"] { opacity: 1; visibility: visible; pointer-events: auto; }

.interface-panel {
  position: fixed;
  z-index: 7;
  top: max(76px, calc(env(safe-area-inset-top) + 60px));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 17px;
  width: min(370px, calc(100vw - 28px));
  max-height: calc(100dvh - 158px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 22px;
  color: #24352e;
  background: rgba(247, 248, 242, 0.97);
  box-shadow: 0 24px 64px rgba(28, 37, 32, 0.23);
  backdrop-filter: blur(22px) saturate(1.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.985);
  transform-origin: top right;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}
.interface-panel[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.interface-panel.phone-shell {
  top: calc(50% + 40px);
  right: max(30px, env(safe-area-inset-right));
  display: block;
  flex: none;
  gap: 0;
  width: min(390px, calc(100vw - 36px));
  height: min(760px, calc(100dvh - 90px));
  max-height: none;
  overflow: visible;
  padding: 9px;
  border: 2px solid rgba(85, 101, 92, 0.8);
  border-radius: 43px;
  color: #24352e;
  background: linear-gradient(145deg, #26312c, #111916);
  box-shadow: 0 28px 80px rgba(20, 29, 24, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: translateY(-50%) translateX(18px) scale(0.97);
  transform-origin: center;
}
.interface-panel.phone-shell[aria-hidden="false"] {
  transform: translateY(-50%) translateX(0) scale(1);
}
.phone-screen {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(25, 37, 30, 0.13);
  border-radius: 32px;
  background: #f4f6f0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}
.phone-screen.quick-panel-open { background: #1f2b24; }
.phone-screen.quick-panel-open .phone-home,
.phone-screen.quick-panel-open .phone-app-screen { background: #1f2b24; }
.phone-status-bar {
  appearance: none;
  position: relative;
  z-index: 1;
  display: flex;
  flex: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  min-height: 37px;
  padding: 8px 22px 4px;
  border: 0;
  border-radius: 30px 30px 0 0;
  color: #35473d;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: grab;
  touch-action: none;
}
.phone-screen.quick-panel-open .phone-status-bar { color: #eef3ed; background: rgba(31, 43, 36, 0.985); }
.phone-screen.quick-panel-open #phone-time { visibility: hidden; }
.phone-status-bar:hover { background: rgba(217, 228, 216, 0.3); }
.phone-status-bar:focus-visible, .phone-quick-panel button:focus-visible, .phone-notification-banner:focus-visible { outline: 2px solid #6d987a; outline-offset: -3px; }
.phone-status-icons { display: inline-flex; align-items: center; gap: 5px; height: 14px; }
.phone-status-icons svg { width: 17px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.phone-status-icons svg:nth-child(2) { width: 19px; }
.phone-status-icons svg:last-child { width: 23px; }
.phone-status-icons .phone-battery-fill { fill: currentColor; stroke: none; }
.phone-home, .phone-app-screen { min-height: 0; flex: 1; }
.phone-home[hidden], .phone-app-screen[hidden], .phone-error[hidden] { display: none; }
.phone-home, .phone-app-screen { filter: brightness(var(--phone-display-brightness, 1)); }
.phone-notification-banner[hidden], .phone-quick-panel[hidden] { display: none; }
.phone-notification-banner {
  appearance: none;
  position: absolute;
  z-index: 4;
  top: 43px;
  right: 11px;
  left: 11px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  color: #34483d;
  background: rgba(249, 250, 246, 0.96);
  box-shadow: 0 10px 28px rgba(27, 40, 32, 0.2);
  font: inherit;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  animation: phone-notification-in 240ms ease-out both;
}
.phone-notification-app-mark { display: grid; width: 32px; height: 32px; flex: none; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(145deg, #5d8a70, #34634d); font-size: 21px; font-weight: 500; }
.phone-notification-banner-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.phone-notification-banner-meta { display: flex; justify-content: space-between; gap: 8px; color: #76847a; font-size: 9px; }
.phone-notification-banner-meta strong { color: #526157; font-size: 9px; font-weight: 750; }
.phone-notification-banner-meta time { white-space: nowrap; }
.phone-notification-banner-copy > strong { color: #2f4437; font-size: 12px; font-weight: 730; }
.phone-notification-banner-copy > span:last-child { overflow: hidden; color: #65736a; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
@keyframes phone-notification-in { from { opacity: 0; transform: translateY(-9px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.phone-quick-panel {
  position: absolute;
  z-index: 7;
  inset: 37px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow: hidden;
  padding: 7px 13px 11px;
  border-radius: 30px;
  color: #f6f8f4;
  background: linear-gradient(155deg, rgba(31, 43, 36, 0.985), rgba(50, 66, 55, 0.97));
  box-shadow: 0 12px 34px rgba(15, 25, 19, 0.2);
  backdrop-filter: blur(24px) saturate(1.14);
  -webkit-backdrop-filter: blur(24px) saturate(1.14);
  animation: phone-center-in 210ms ease-out both;
}
@keyframes phone-center-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.phone-quick-panel.is-closing { pointer-events: none; animation: phone-center-out 210ms ease-in both; }
@keyframes phone-center-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }
.phone-quick-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 2px 1px; }
.phone-quick-clock { display: grid; gap: 1px; }
.phone-quick-clock span { color: rgba(241, 246, 239, 0.76); font-size: 11px; font-weight: 650; }
.phone-quick-clock strong { color: #fff; font-size: 34px; font-weight: 720; letter-spacing: -0.06em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.phone-quick-grid { display: grid; flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.phone-quick-toggle { appearance: none; display: flex; min-width: 0; min-height: 55px; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid rgba(244, 248, 242, 0.13); border-radius: 15px; color: #eff4ee; background: rgba(246, 249, 244, 0.1); font: inherit; text-align: left; cursor: pointer; transition: background 140ms ease, color 140ms ease, transform 140ms ease; }
.phone-quick-toggle:hover { background: rgba(246, 249, 244, 0.18); }
.phone-quick-toggle:active { transform: scale(0.97); }
.phone-quick-toggle.is-active { border-color: rgba(255, 255, 255, 0.8); color: #2e4437; background: #edf3ea; }
.phone-quick-toggle-icon { display: grid; width: 30px; height: 30px; flex: none; place-items: center; border-radius: 50%; color: currentColor; background: rgba(255, 255, 255, 0.13); }
.phone-quick-toggle-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.phone-quick-toggle.is-active .phone-quick-toggle-icon { background: rgba(67, 111, 82, 0.13); }
.phone-quick-toggle > span:last-child { display: grid; min-width: 0; gap: 2px; }
.phone-quick-toggle strong { overflow: hidden; font-size: 10px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.phone-quick-toggle small { color: currentColor; opacity: 0.69; font-size: 8px; line-height: 1.1; }
.phone-brightness-control { display: flex; flex: none; align-items: center; gap: 9px; min-height: 39px; padding: 0 11px; border: 1px solid rgba(244, 248, 242, 0.12); border-radius: 13px; background: rgba(246, 249, 244, 0.1); }
.phone-brightness-control > span { color: #fff; font-size: 17px; }
.phone-brightness-control input { min-width: 0; height: 22px; flex: 1; accent-color: #eaf0e6; cursor: pointer; }
.phone-brightness-control strong { min-width: 32px; color: rgba(248, 250, 247, 0.86); font-size: 8px; font-weight: 650; text-align: right; }
.phone-notifications { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 8px; overflow: hidden; padding-top: 2px; }
.phone-notifications-header { display: flex; flex: none; align-items: center; justify-content: space-between; min-height: 24px; }
.phone-notifications-header > div { display: flex; align-items: center; gap: 7px; }
.phone-notifications-header h3 { margin: 0; color: #fff; font-size: 13px; font-weight: 730; letter-spacing: -0.015em; }
.phone-notification-count { display: grid; min-width: 17px; height: 17px; padding: 0 4px; place-items: center; border-radius: 99px; color: #34483d; background: #dfe9dc; font-size: 8px; font-weight: 760; }
.phone-notification-count[hidden] { display: none; }
.phone-notifications-header button { appearance: none; padding: 4px 7px; border: 0; border-radius: 8px; color: rgba(245, 248, 243, 0.75); background: transparent; font: inherit; font-size: 9px; font-weight: 650; cursor: pointer; }
.phone-notifications-header button:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.phone-notifications-header button:disabled { opacity: 0.42; cursor: default; }
.phone-notifications-empty { display: grid; min-height: 74px; flex: none; place-items: center; margin: 0; border: 1px dashed rgba(243, 248, 241, 0.2); border-radius: 15px; color: rgba(241, 246, 239, 0.72); font-size: 10px; }
.phone-notifications-empty[hidden] { display: none; }
.phone-notification-list { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 7px; overflow-y: auto; overscroll-behavior: contain; padding: 1px 2px 6px 1px; scrollbar-color: rgba(241, 246, 239, 0.32) transparent; scrollbar-width: thin; }
.phone-notification-card { appearance: none; display: grid; flex: none; grid-template-columns: 30px minmax(0, 1fr) 7px; gap: 9px; align-items: flex-start; width: 100%; padding: 10px; border: 1px solid rgba(255, 255, 255, 0.56); border-radius: 15px; color: #35483b; background: rgba(248, 250, 245, 0.96); font: inherit; text-align: left; cursor: pointer; }
.phone-notification-card:hover { background: #fff; }
.phone-notification-card[data-unread="false"] { background: rgba(237, 241, 234, 0.91); }
.phone-notification-card-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(145deg, #5d8a70, #34634d); font-size: 19px; }
.phone-notification-card-copy { display: grid; min-width: 0; gap: 2px; }
.phone-notification-card-meta { display: flex; justify-content: space-between; gap: 6px; color: #78857b; font-size: 8px; }
.phone-notification-card-meta strong { color: #54645a; font-size: 8px; font-weight: 750; }
.phone-notification-card-title { color: #34483b; font-size: 10px; font-weight: 730; }
.phone-notification-card-message { color: #68766d; font-size: 9px; line-height: 1.35; overflow-wrap: anywhere; }
.phone-notification-unread-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #d76d63; }
.phone-notification-card[data-unread="false"] .phone-notification-unread-dot { visibility: hidden; }
.phone-app-badge { position: absolute; top: -5px; right: -6px; display: grid; min-width: 18px; height: 18px; padding: 0 4px; place-items: center; border: 2px solid #f4f6f0; border-radius: 99px; color: #fff; background: #d75f59; font-family: inherit; font-size: 8px; font-weight: 760; line-height: 1; }
.phone-app-badge[hidden] { display: none; }
.phone-home-indicator { position: relative; z-index: 8; }
.phone-quick-panel:not([hidden]) ~ .phone-home-indicator { cursor: grab; touch-action: none; }
.phone-home {
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  padding: 18px 19px 16px;
  background:
    radial-gradient(ellipse at 50% 5%, rgba(224, 235, 219, 0.86), transparent 52%),
    linear-gradient(180deg, #f5f7f1, #eef2e9);
}
.phone-home-heading h2 { margin: 5px 0 0; color: #293b31; font-size: 24px; font-weight: 680; letter-spacing: -0.05em; }
.phone-home-heading p { margin: 5px 0 0; color: #77847b; font-size: 11px; }
.phone-app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 8px; }
.phone-app {
  appearance: none;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
  border: 0;
  border-radius: 14px;
  color: #405047;
  background: transparent;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.phone-app:hover .phone-app-icon { transform: translateY(-2px); box-shadow: 0 9px 18px rgba(34, 50, 40, 0.14); }
.phone-app:active .phone-app-icon { transform: scale(0.95); }
.phone-app:focus-visible, .phone-error-back:focus-visible { outline: 2px solid #648b75; outline-offset: 3px; }
.phone-app-icon {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  box-shadow: 0 5px 12px rgba(31, 45, 36, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.phone-app-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-tone-dosis { background: linear-gradient(145deg, #5d8a70, #34634d); }
.app-tone-coral { background: linear-gradient(145deg, #e78979, #ce675c); }
.app-tone-blue { background: linear-gradient(145deg, #77a7ca, #4d7fa7); }
.app-tone-gold { background: linear-gradient(145deg, #e6bd68, #c98a43); }
.app-tone-violet { background: linear-gradient(145deg, #9a89c2, #70619b); }
.app-tone-teal { background: linear-gradient(145deg, #68b3a5, #3d867e); }
.app-tone-mint { background: linear-gradient(145deg, #82bca1, #559278); }
.app-tone-slate { background: linear-gradient(145deg, #758c98, #506771); }
.app-tone-gray { background: linear-gradient(145deg, #a0aaa2, #78857c); }
.phone-app-name { max-width: 100%; color: #48584f; font-size: 10px; font-weight: 630; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.phone-app-screen { display: flex; flex-direction: column; background: #f4f6f0; }
.phone-app-header {
  flex: none;
  min-height: 56px;
  padding: 7px 15px;
  border-bottom: 1px solid rgba(45, 67, 56, 0.08);
}
.phone-app-header .panel-close { width: 32px; height: 32px; color: #4b6b58; background: #e7eee5; }
.phone-app-header .panel-close:hover { color: #315844; background: #dce8dc; }
.phone-app-header .panel-close svg { width: 17px; height: 17px; }
.phone-app-header h2 { margin: 0; flex: 1; text-align: center; font-size: 18px; }
.phone-app-header-mark { width: 32px; height: 32px; flex: none; }
.phone-app-content {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 13px 14px;
  scrollbar-color: #c4d0c3 transparent;
  scrollbar-width: thin;
}
.phone-app-content .medication-section { padding: 12px 13px; gap: 8px; }
.phone-app-content .dose-card { padding: 14px; }
.phone-app-content .dose-progress-row { gap: 11px; margin: 12px 0; }
.phone-app-content .dose-ring { width: 76px; height: 76px; }
.phone-app-content .dose-ring::before { width: 64px; height: 64px; }
.phone-app-content .history-card { padding: 12px 13px 10px; }
.phone-error {
  position: absolute;
  z-index: 3;
  inset: 37px 0 18px;
  display: grid;
  place-items: center;
  padding: 22px;
  border-radius: 30px;
  background: rgba(31, 41, 35, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.phone-remove-dialog {
  position: absolute;
  z-index: 5;
  inset: 37px 0 18px;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 30px;
  background: rgba(31, 41, 35, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.phone-remove-dialog[hidden] { display: none; }
.phone-remove-card {
  width: min(280px, 100%);
  padding: 22px 19px 18px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 22px;
  color: #34483d;
  background: #f8f9f5;
  box-shadow: 0 18px 48px rgba(18, 29, 22, 0.22);
  text-align: center;
}
.phone-remove-symbol { display: grid; width: 38px; height: 38px; margin: 0 auto 12px; place-items: center; border-radius: 50%; color: #a65d4f; background: #f4e4de; font-size: 20px; font-weight: 750; }
.phone-remove-card h2 { margin: 0; color: #32463a; font-size: 16px; font-weight: 680; letter-spacing: -0.025em; }
.phone-remove-card p { margin: 8px 0 18px; color: #738077; font-size: 11px; line-height: 1.5; }
.phone-remove-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.phone-remove-actions button { appearance: none; min-height: 39px; border: 0; border-radius: 11px; font: inherit; font-size: 11px; font-weight: 680; cursor: pointer; }
.phone-remove-cancel { color: #4e6357; background: #e8eee7; }
.phone-remove-cancel:hover { background: #dce6dc; }
.phone-remove-confirm { color: #fff8f5; background: #a65d4f; }
.phone-remove-confirm:hover { background: #8e4a3e; }
.phone-remove-actions button:focus-visible { outline: 2px solid #648b75; outline-offset: 3px; }
.phone-error-card {
  width: min(270px, 100%);
  padding: 23px 20px 19px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  color: #34483d;
  background: #f8f9f5;
  box-shadow: 0 18px 48px rgba(18, 29, 22, 0.2);
  text-align: center;
}
.phone-error-symbol { display: grid; width: 38px; height: 38px; margin: 0 auto 12px; place-items: center; border-radius: 50%; color: #a65d4f; background: #f4e4de; font-size: 21px; font-weight: 750; }
.phone-error-card h2 { margin: 0; color: #32463a; font-size: 16px; font-weight: 680; letter-spacing: -0.025em; }
.phone-error-card p { margin: 8px 0 17px; color: #738077; font-size: 11px; line-height: 1.45; }
.phone-error-back { appearance: none; width: 100%; min-height: 38px; border: 0; border-radius: 11px; color: #f7f8f3; background: #416e5a; font: inherit; font-size: 11px; font-weight: 680; cursor: pointer; }
.phone-error-back:hover { background: #315b48; }
.phone-home-indicator { display: grid; flex: none; height: 20px; place-items: center; background: #f4f6f0; }
.phone-home-indicator span { width: 94px; height: 4px; border-radius: 99px; background: #26342c; opacity: 0.76; }
.simulation-panel { width: min(380px, calc(100vw - 28px)); }
.presentation-card {
  position: fixed;
  z-index: 6;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 78px));
  width: min(300px, calc(100vw - 32px));
  padding: 13px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  color: #30443a;
  background: rgba(248, 249, 244, 0.94);
  box-shadow: 0 12px 34px rgba(28, 37, 32, 0.16);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}
.presentation-card[hidden] { display: none; }
.presentation-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #6a7d70; font-size: 10px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
#presentation-exit { appearance: none; width: 25px; height: 25px; border: 0; border-radius: 8px; color: #758078; background: transparent; font: inherit; font-size: 18px; cursor: pointer; }
#presentation-exit:hover { color: #33473d; background: #e8eee7; }
.presentation-card p { margin: 5px 0 10px; color: #34493e; font-size: 12px; line-height: 1.45; }
.presentation-next { appearance: none; width: 100%; min-height: 35px; border: 0; border-radius: 10px; color: #f7f8f3; background: #416e5a; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.presentation-next:hover:not(:disabled) { background: #315b48; }
.presentation-next:disabled { color: #78847c; background: #e1e6df; cursor: default; }
.component-key {
  position: fixed;
  z-index: 4;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 78px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  max-width: min(500px, calc(100vw - 32px));
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 12px;
  color: #4c6055;
  background: rgba(248, 249, 244, 0.84);
  box-shadow: 0 8px 25px rgba(28, 37, 32, 0.1);
  font-size: 10px;
  line-height: 1.3;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.component-key[hidden] { display: none; }
.component-key span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.component-key i { width: 7px; height: 7px; border-radius: 50%; background: #8ca797; }
.component-key .key-led { background: #d3626b; box-shadow: 0 0 0 3px rgba(211, 98, 107, 0.1); }
.component-key .key-circuit { background: #668b79; }
.component-key .key-sensor { background: #b0a38e; }
.component-key .key-battery { background: #38433e; }
.presentation-active .interface-panel:not(.phone-shell) { max-height: calc(100dvh - 174px); }
.panel-header, .dose-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-header > div, .dose-card-heading > div { min-width: 0; }
.panel-header h2 {
  margin: 4px 0 0;
  color: #24352e;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.04em;
}
.panel-close {
  appearance: none;
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: #60716a;
  background: transparent;
  cursor: pointer;
}
.panel-close:hover { color: #304239; background: #e7ebe5; }
.panel-close svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.app-clock-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 13px 0 1px;
  border-top: 1px solid rgba(45, 67, 56, 0.11);
}
.app-clock-row strong {
  display: block;
  margin-top: 3px;
  color: #273b33;
  font-size: 27px;
  font-weight: 620;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.panel-label { color: #728078; font-size: 9px; letter-spacing: 0.12em; }
.week-navigation { display: flex; flex-direction: column; gap: 9px; }
.week-navigation-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.week-navigation-heading strong {
  display: block;
  margin-top: 3px;
  color: #354b3f;
  font-size: 12px;
  font-weight: 650;
}
.week-navigation-heading small { display: block; margin-top: 4px; color: #77847b; font-size: 10px; line-height: 1.35; }
.week-navigation-heading .simulation-status { max-width: 300px; color: #416e5a; font-size: 9px; font-weight: 650; }
.week-navigation-heading .simulation-status:empty { display: none; }
.day-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.day-picker button {
  appearance: none;
  min-width: 0;
  min-height: 34px;
  padding: 0 2px;
  border: 1px solid rgba(54, 76, 65, 0.1);
  border-radius: 10px;
  color: #64736b;
  background: #f2f4ef;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.day-picker button:hover { color: #315844; background: #e7eee7; border-color: rgba(54, 100, 70, 0.2); }
.day-picker button:active { transform: scale(0.96); }
.day-picker button[aria-pressed="true"] {
  color: #f7f8f3;
  background: #416e5a;
  border-color: #416e5a;
  box-shadow: 0 3px 8px rgba(39, 79, 57, 0.16);
}
.day-picker button::after { content: ""; display: block; width: 5px; height: 5px; margin: 3px auto 0; border-radius: 50%; background: #a7b0a8; }
.day-picker button[data-day-state="complete"]::after { background: #63a174; }
.day-picker button[data-day-state="active"]::after { background: #d6a45e; }
.day-picker button[data-day-state="missed"]::after { background: #c57762; }
.simulation-clock-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid rgba(54, 76, 65, 0.1);
  border-radius: 16px;
  background: linear-gradient(135deg, #eaf1e9, #f7f8f2);
}
.simulation-clock-card strong {
  display: block;
  margin-top: 3px;
  color: #2e493c;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.simulation-live-dot { width: 10px; height: 10px; border-radius: 50%; background: #6c9d76; box-shadow: 0 0 0 5px rgba(108, 157, 118, 0.12); }
.simulation-controls { display: flex; flex-direction: column; gap: 10px; padding-top: 15px; border-top: 1px solid rgba(45, 67, 56, 0.11); }
.simulation-transport { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.simulation-transport .icon-control {
  width: 42px;
  height: 40px;
  border-color: rgba(54, 76, 65, 0.1);
  color: #586c61;
  background: #f1f4ef;
}
.simulation-transport .icon-control:hover { color: #315844; background: #e4ece4; }
.simulation-transport .primary-control { color: #f7f8f3; background: #416e5a; }
.simulation-transport .primary-control:hover { color: #fff; background: #315b48; }
.simulation-transport .primary-control svg { fill: currentColor; stroke: none; }
.simulation-transport #next-dose:disabled { opacity: 0.38; cursor: default; }
.simulation-timeline { width: 100%; min-height: 28px; margin: 0; }
.simulation-timeline::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, #60856e var(--progress, 0%), #dfe6dd var(--progress, 0%)); }
.simulation-timeline::-moz-range-track { height: 4px; background: #dfe6dd; }
.simulation-timeline::-moz-range-progress { height: 4px; background: #60856e; }
.simulation-timeline::-webkit-slider-thumb { margin-top: -4px; border-color: #fff; background: #416e5a; box-shadow: 0 1px 5px rgba(25, 49, 35, 0.28); }
.simulation-timeline::-moz-range-thumb { border-color: #fff; background: #416e5a; box-shadow: 0 1px 5px rgba(25, 49, 35, 0.28); }
.timeline-labels { display: flex; justify-content: space-between; margin-top: -7px; color: #78847c; font-size: 9px; font-variant-numeric: tabular-nums; }
.simulation-reset {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 39px;
  margin-top: 2px;
  border: 1px solid rgba(54, 76, 65, 0.1);
  border-radius: 12px;
  color: #586c61;
  background: #f7f8f3;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.simulation-reset:hover { color: #315844; background: #e9eee7; }
.simulation-reset svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dose-state, .dose-day {
  flex: none;
  padding: 6px 9px;
  border-radius: 999px;
  color: #486b5a;
  background: #e0e9e0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.dose-day {
  padding: 5px 8px;
  color: #617169;
  background: #e2e8e0;
  font-size: 9px;
  letter-spacing: 0.06em;
}
.dose-state[data-state="pending"] { color: #8c6742; background: #f1e7d5; }
.dose-state[data-state="confirmed"] { color: #386a4f; background: #d9eadb; }
.dose-state[data-state="missed"] { color: #97583f; background: #f1dfd6; }

.medication-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px;
  border: 1px solid rgba(54, 76, 65, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}
.medication-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.medication-heading h3 { margin: 4px 0 0; color: #30443a; font-size: 14px; font-weight: 660; letter-spacing: -0.02em; }
.medication-count, .history-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  color: #476b58;
  background: #e3ebe2;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.medication-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.medication-empty { padding: 2px 0; color: #77847b; font-size: 10px; line-height: 1.45; }
.medication-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 11px;
  background: #f1f4ee;
}
.medication-color-swatch { width: 12px; height: 12px; flex: none; border: 1px solid rgba(54, 76, 65, 0.16); border-radius: 50%; background: var(--medicine-color, #c5d4d5); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28); }
.medication-item-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.medication-item-copy strong { overflow: hidden; color: #35493e; font-size: 11px; font-weight: 660; text-overflow: ellipsis; white-space: nowrap; }
.medication-item-copy small { color: #78847c; font-size: 10px; }
.medication-item-copy .medication-item-stock { color: #466752; font-size: 9px; font-weight: 700; }
.medication-item-stock[data-stock-level="low"] { color: #a7654e; }
.medication-stock-row { display: flex; align-items: center; gap: 6px; min-height: 19px; }
.stock-refill { appearance: none; min-width: 27px; height: 19px; padding: 0 5px; border: 1px solid rgba(68, 104, 83, 0.16); border-radius: 7px; color: #466b55; background: #e7eee5; font: inherit; font-size: 9px; font-weight: 750; cursor: pointer; }
.stock-refill:hover:not(:disabled) { color: #fff; background: #50785e; }
.stock-refill:disabled { color: #9aa39b; background: #eff1ec; cursor: default; }
.medication-item-end { display: flex; flex: none; align-items: center; gap: 6px; }
.medication-schedule { display: grid; justify-items: end; gap: 3px; }
.medication-time { padding: 5px 7px; border-radius: 8px; color: #466752; background: #e2ebe1; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.medication-frequency { color: #77847b; font-size: 8px; font-weight: 650; white-space: nowrap; }
.medication-remove {
  appearance: none;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #8b7770;
  background: transparent;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.medication-remove:hover { color: #824d3f; background: #f2e5df; }
.add-medication { border-top: 1px solid rgba(54, 76, 65, 0.1); padding-top: 10px; }
.add-medication summary { color: #416e5a; font-size: 11px; font-weight: 680; cursor: pointer; list-style: none; }
.add-medication summary::-webkit-details-marker { display: none; }
.add-medication summary span { margin-right: 4px; font-size: 15px; vertical-align: -1px; }
.medication-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 11px; }
.medication-form label { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: #68766e; font-size: 10px; font-weight: 620; }
.medication-form label:first-child, .medication-form > p, .medication-submit { grid-column: 1 / -1; }
.medication-form input, .medication-form select {
  appearance: none;
  min-width: 0;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(54, 76, 65, 0.15);
  border-radius: 9px;
  outline: none;
  color: #34483d;
  background: #fbfcf8;
  font: inherit;
  font-size: 11px;
}
.medication-form select { appearance: auto; padding-right: 7px; }
.medication-form input:focus, .medication-form select:focus { border-color: #72937f; box-shadow: 0 0 0 3px rgba(114, 147, 127, 0.15); }
.medication-form > p { margin: 0; color: #7a867e; font-size: 10px; line-height: 1.4; }
.medication-form .medication-form-note { margin-top: -4px; color: #7d8982; font-size: 9px; }
.medication-submit {
  appearance: none;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  color: #f7f8f3;
  background: #416e5a;
  font: inherit;
  font-size: 11px;
  font-weight: 680;
  cursor: pointer;
}
.medication-submit:hover { background: #315b48; }
.medication-submit:disabled { color: #7c867e; background: #dfe5dc; cursor: not-allowed; }
.medication-limit-message { color: #956b45 !important; }

.dose-card {
  padding: 17px;
  border: 1px solid rgba(54, 76, 65, 0.09);
  border-radius: 17px;
  background: #eef1eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.dose-card-heading { align-items: center; gap: 8px; }
.dose-card h3 {
  margin: 4px 0 0;
  color: #30443a;
  font-size: 15px;
  font-weight: 660;
  letter-spacing: -0.02em;
}
.dose-progress-row { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.dose-ring {
  position: relative;
  display: grid;
  flex: none;
  width: 84px;
  height: 84px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#5d8870 var(--progress, 16%), #d8e0d7 0);
}
.dose-ring::before {
  content: "";
  grid-area: 1 / 1;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #f7f8f3;
}
.dose-ring > div {
  z-index: 1;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dose-ring strong { color: #33483d; font-size: 17px; font-weight: 670; font-variant-numeric: tabular-nums; }
.dose-ring span { color: #7a8780; font-size: 9px; }
.dose-ring[data-state="pending"] { background: conic-gradient(#b38a56 var(--progress, 40%), #d8e0d7 0); }
.dose-ring[data-state="confirmed"] { background: conic-gradient(#5e936d var(--progress, 100%), #d8e0d7 0); }
.dose-ring[data-state="missed"] { background: conic-gradient(#b87356 var(--progress, 100%), #d8e0d7 0); }
.dose-details { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 5px; }
.dose-details strong { color: #32453b; font-size: 12px; font-weight: 650; line-height: 1.35; }
.dose-details span { color: #718077; font-size: 11px; line-height: 1.45; }
.dose-confirm {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: #f7f8f3;
  background: #416e5a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.2;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.dose-confirm:hover:not(:disabled) { color: #fff; background: #315b48; }
.dose-confirm:disabled { color: #758078; background: #dce2dc; cursor: not-allowed; opacity: 0.9; }

.history-card {
  padding: 14px 15px 12px;
  border: 1px solid rgba(54, 76, 65, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-heading h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 0;
  color: #30443a;
  font-size: 14px;
  font-weight: 660;
  letter-spacing: -0.02em;
}
.history-empty { margin: 10px 0 0; color: #77847b; font-size: 10px; line-height: 1.45; }
.history-list { display: grid; gap: 0; margin: 8px 0 0; padding: 0; list-style: none; }
.history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(54, 76, 65, 0.09);
}
.history-entry-main { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.history-entry-day { color: #35493e; font-size: 11px; font-weight: 660; }
.history-entry-sim-time { color: #78847c; font-size: 10px; }
.history-entry-saved { flex: none; color: #758178; font-size: 10px; font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.transport {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(560px, calc(100vw - 28px));
  height: 56px;
  padding: 7px 10px;
  border: 1px solid var(--control-line);
  border-radius: 17px;
  background: var(--control-glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
}
.icon-control {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--control-muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.icon-control:hover { color: #f4f5ef; background: rgba(255, 255, 255, 0.075); }
.icon-control:active { transform: scale(0.96); }
.icon-control svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-control:hover::after {
  content: attr(title);
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(180px, calc(100vw - 32px));
  padding: 6px 8px;
  border-radius: 7px;
  color: #edf1ec;
  background: rgba(33, 42, 39, 0.94);
  font-size: 10px;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
  transform: translateX(-50%);
}
.primary-control {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #1e312b;
  background: #b3c4ba;
}
.primary-control:hover { color: #15241f; background: #c4d1c8; }
.primary-control svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.timeline {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  min-width: 46px;
  height: 24px;
  margin: 0 3px;
  background: transparent;
  cursor: pointer;
  touch-action: pan-x;
}
.timeline::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(to right, #aec7b8 var(--progress, 0%), rgba(223, 229, 222, 0.28) var(--progress, 0%));
}
.timeline::-moz-range-track { height: 2px; border-radius: 999px; background: rgba(223, 229, 222, 0.28); }
.timeline::-moz-range-progress { height: 2px; border-radius: 999px; background: #aec7b8; }
.timeline::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border: 2px solid #e8eee8;
  border-radius: 50%;
  background: #91b09f;
  box-shadow: 0 1px 6px rgba(11, 22, 17, 0.4);
}
.timeline::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 2px solid #e8eee8;
  border-radius: 50%;
  background: #91b09f;
  box-shadow: 0 1px 6px rgba(11, 22, 17, 0.4);
}
#speed[data-speed="5"], #speed[data-speed="15"] { color: #237c70; }
#speed[data-speed="15"] { background: #f1e7d5; }
.component-control[aria-pressed="true"] { color: #2f5d49; background: #e6f1e6; border-color: rgba(48, 93, 73, 0.18); }

@media (max-width: 640px) {
  .scene-intro { top: 13px; left: 14px; width: calc(100vw - 185px); }
  .scene-intro h1 { font-size: 21px; }
  .scene-description { display: none; }
  .gesture-hint { max-width: 190px; font-size: 10px; }
  .lid-control { min-height: 34px; margin-top: 9px; padding-inline: 10px; }
  .interface-launcher { top: 13px; right: 13px; height: 39px; padding-inline: 10px; }
  .simulation-launcher { top: 13px; right: 118px; width: 39px; height: 39px; border-radius: 13px; }
  .presentation-launcher { top: 62px; right: 13px; width: 39px; height: 39px; padding: 0; border-radius: 12px; }
  .presentation-launcher span { display: none; }
  .presentation-card { right: 12px; bottom: max(68px, calc(env(safe-area-inset-bottom) + 62px)); left: auto; width: min(320px, calc(100vw - 24px)); padding: 11px 12px; }
  .presentation-card p { margin-block: 3px 8px; font-size: 11px; }
  .presentation-active .interface-panel:not(.phone-shell) { top: 62px; right: 12px; width: min(370px, calc(100vw - 24px)); max-height: calc(100dvh - 300px); padding: 15px; gap: 11px; }
  .presentation-active .component-key { bottom: 175px; }
  .interface-panel { top: 62px; right: 12px; width: min(370px, calc(100vw - 24px)); max-height: calc(100dvh - 140px); padding: 18px; gap: 14px; }
  .interface-panel.phone-shell { top: calc(50% + 40px); right: 50%; width: min(390px, calc(100vw - 22px)); height: min(760px, calc(100dvh - 90px)); padding: 8px; border-radius: 39px; transform: translate(50%, -50%) scale(0.97); }
  .interface-panel.phone-shell[aria-hidden="false"] { transform: translate(50%, -50%) scale(1); }
  .phone-screen { border-radius: 30px; }
  .phone-status-bar { min-height: 34px; padding-inline: 18px; }
  .phone-home { gap: 18px; padding: 16px 16px 13px; }
  .phone-app-grid { gap: 15px 6px; }
  .phone-app-icon { width: 54px; height: 54px; border-radius: 17px; }
  .phone-app-content { gap: 9px; padding: 10px 10px 12px; }
  .phone-app-content .medication-section { padding: 10px; }
  .phone-app-content .dose-card { padding: 12px; }
  .phone-app-content .dose-progress-row { gap: 9px; }
  .phone-app-content .dose-ring { width: 70px; height: 70px; }
  .phone-app-content .dose-ring::before { width: 59px; height: 59px; }
  .phone-error { padding: 16px; }
  .component-key { right: 10px; bottom: max(68px, calc(env(safe-area-inset-bottom) + 62px)); left: 10px; justify-content: center; gap: 6px 9px; max-width: none; padding: 7px 8px; font-size: 9px; }
  .medication-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .medication-form label { font-size: 9px; }
  .medication-form input, .medication-form select { padding: 0 7px; font-size: 10px; }
  .transport { width: calc(100vw - 18px); height: 52px; gap: 3px; padding: 6px; border-radius: 15px; }
  .icon-control { width: 34px; height: 34px; border-radius: 10px; }
  .primary-control { width: 36px; height: 36px; }
  .icon-control svg { width: 18px; height: 18px; }
  .timeline { margin: 0 1px; }
  .simulation-timeline { margin: 0; }
}
@media (max-width: 390px) {
  .scene-intro h1 { margin-top: 0; }
  .gesture-hint { max-width: 160px; font-size: 9px; }
  .medication-item { padding: 8px; gap: 5px; }
  .medication-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .medication-time { padding-inline: 5px; font-size: 9px; }
  .medication-remove { width: 22px; }
  .day-picker { gap: 3px; }
  .day-picker button { min-height: 32px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Dosis Clara's five connected phone screens. */
#phone-app-screen { color: #294542; background: #f7f7f1; }
#phone-app-screen [hidden] { display: none !important; }
#phone-app-screen .phone-app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 9px;
  min-height: 52px; padding: 7px 13px; border-bottom: 0; background: #f7f7f1;
}
#phone-app-screen .phone-app-header .panel-close {
  width: 28px; height: 30px; flex: none; color: #1d5861; background: transparent;
}
#phone-app-screen .phone-app-header .panel-close:hover { color: #123f48; background: #e8eeea; }
#phone-app-screen .phone-app-header .panel-close svg { width: 18px; height: 18px; }
.agenda-brand { display: flex; flex: 1; align-items: center; gap: 7px; color: #1b575f; font-size: 13px; font-weight: 700; }
.agenda-brand-icon { display: grid; width: 19px; height: 19px; place-items: center; }
.agenda-brand-icon svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.agenda-settings-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 6px 7px; border: 0; border-radius: 8px; color: #205a61; background: transparent; font-size: 10px; font-weight: 650; cursor: pointer; }
.agenda-settings-toggle svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.agenda-settings-toggle:hover, .agenda-settings-toggle[aria-expanded="true"] { background: #e6efea; }
.phone-route-header { display: flex; flex: none; align-items: center; justify-content: space-between; min-height: 44px; padding: 5px 14px; color: #52706a; background: #f7f7f1; font-size: 9px; }
.phone-route-header > span { font-size: 9px; }
.phone-route-header button { display: inline-flex; align-items: center; gap: 4px; padding: 6px 0; border: 0; color: #1b5960; background: transparent; font-size: 11px; font-weight: 650; cursor: pointer; }
.phone-route-header button svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#phone-app-screen .phone-app-content { gap: 0; padding: 0; overflow-x: hidden; background: #f7f7f1; scrollbar-width: thin; }
.phone-flow-page { display: flex; min-height: 100%; flex: 1; flex-direction: column; padding: 12px 14px 14px; }
.phone-flow-page[hidden], .phone-route-header[hidden], .agenda-settings-content[hidden] { display: none !important; }
.agenda-page { gap: 8px; }
.agenda-greeting { flex: none; padding: 1px 1px 4px; }
.agenda-greeting h1 { margin: 0 0 3px; color: #294b4d; font-size: 22px; font-weight: 530; letter-spacing: -0.55px; line-height: 1.18; }
.agenda-greeting p { margin: 0; color: #75837c; font-size: 10px; }
.agenda-dose-card { flex: none; padding: 12px 12px 11px; border: 1px solid #e0e8e1; border-radius: 15px; background: #fff; box-shadow: 0 2px 8px rgba(38, 69, 58, 0.025); }
.agenda-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agenda-card-heading h2 { margin: 0; color: #34504a; font-size: 11px; font-weight: 700; }
.agenda-day { padding: 4px 8px; border-radius: 99px; color: #59736a; background: #e8efe8; font-size: 9px; font-weight: 600; }
.agenda-dose-row { display: flex; align-items: center; gap: 11px; margin: 8px 0 6px; }
.agenda-dose-time { display: grid; width: 74px; height: 74px; flex: none; place-items: center; border: 6px solid #e1e9e1; border-radius: 50%; background: #f8faf6; }
.agenda-dose-time strong { color: #294a4b; font-size: 15px; font-weight: 720; letter-spacing: -0.5px; line-height: 1.05; text-align: center; white-space: nowrap; }
.agenda-dose-details { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.agenda-dose-details strong { color: #3d554d; font-size: 10px; font-weight: 680; overflow-wrap: anywhere; }
.agenda-dose-details span { color: #78847e; font-size: 9px; line-height: 1.4; }
.agenda-recipe-note { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 4px 7px; border-radius: 6px; color: #477165; background: #e4f0e8; font-size: 8px; font-weight: 620; }
.agenda-recipe-note svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#phone-app-screen .dose-confirm.agenda-primary, .agenda-primary {
  display: grid; width: 100%; min-height: 40px; flex: none; place-items: center; padding: 9px 12px;
  border: 1px solid #175a65; border-radius: 9px; color: #fff; background: #175a65;
  box-shadow: 0 1px 2px rgba(12, 65, 73, .12); font-size: 10px; font-weight: 680; cursor: pointer;
}
#phone-app-screen .dose-confirm.agenda-primary:hover:not(:disabled), .agenda-primary:hover:not(:disabled) { background: #124b55; }
#phone-app-screen .dose-confirm.agenda-primary:disabled, .agenda-primary:disabled { border-color: #dfe6df; color: #84918a; background: #dfe6df; box-shadow: none; cursor: default; }
.agenda-secondary { display: grid; width: 100%; min-height: 38px; flex: none; place-items: center; padding: 8px 12px; border: 1px solid #40757b; border-radius: 9px; color: #315e62; background: #fff; font-size: 10px; font-weight: 650; cursor: pointer; }
.agenda-secondary:hover { background: #eef5f1; }
.agenda-link { display: flex; min-height: 42px; flex: none; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #e1e9e1; border-radius: 10px; color: #365a55; background: rgba(255,255,255,.91); text-align: left; cursor: pointer; }
.agenda-link + .agenda-link { margin-top: 0; }
.agenda-link:disabled { opacity: .62; cursor: default; }
.agenda-link:hover:not(:disabled) { border-color: #bfd4ca; background: #fff; }
.agenda-link-icon { display: grid; width: 20px; height: 20px; flex: none; place-items: center; color: #528078; }
.agenda-link-icon svg, .agenda-chevron { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.agenda-link-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.agenda-link-copy strong { color: #385a54; font-size: 9px; font-weight: 700; }
.agenda-link-copy small { color: #71827a; font-size: 8px; line-height: 1.25; }
.agenda-chevron { flex: none; color: #54756f; }
.agenda-settings-content { display: flex; flex: none; flex-direction: column; gap: 8px; padding-top: 8px; }
.agenda-settings-content > h2 { margin: 0; color: #49635c; font-size: 11px; }
#phone-app-screen .medication-section, #phone-app-screen .history-card { border: 1px solid #e0e8e1; border-radius: 13px; background: #fff; }
#phone-app-screen .medication-section { padding: 11px; }
#phone-app-screen .history-card { padding: 10px 11px; }
.phone-flow-subpage { gap: 10px; padding: 17px 14px 14px; }
.flow-icon { display: grid; width: 43px; height: 43px; flex: none; place-items: center; border-radius: 14px; color: #42796e; background: #e0f0e8; }
.flow-icon svg { width: 27px; height: 27px; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.flow-icon-success { width: 68px; height: 68px; align-self: center; margin: 13px 0 1px; border-radius: 21px; color: #387768; background: #e0f1e8; }
.flow-icon-success svg { width: 32px; height: 32px; stroke-width: 2; }
#confirmation-page { align-items: center; text-align: center; }
#confirmation-page h1, #confirmation-page .flow-intro { width: 100%; text-align: center; }
#confirmation-page .flow-summary-card { width: 100%; margin-top: 5px; }
.phone-flow-subpage h1 { margin: 1px 0 0; color: #294b4d; font-size: 21px; font-weight: 540; letter-spacing: -.45px; line-height: 1.2; }
.phone-flow-subpage .flow-intro { margin: -3px 0 1px; color: #74827c; font-size: 10px; line-height: 1.5; }
.flow-summary-card { display: flex; flex: none; flex-direction: column; align-items: center; gap: 7px; padding: 13px 12px; border: 1px solid #e1e9e1; border-radius: 14px; background: #fff; text-align: center; }
.flow-confirmed-label { display: inline-flex; align-items: center; gap: 4px; color: #52776b; font-size: 9px; font-weight: 650; }
.flow-confirmed-label svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.flow-summary-time { color: #294b4d; font-size: 19px; line-height: 1; }
.flow-summary-card > span:last-child { color: #687b73; font-size: 9px; }
.flow-bottom-action { margin-top: auto; }
.permission-card { flex: none; padding: 12px; border: 1px solid #e2e9e2; border-radius: 13px; background: #fff; }
.permission-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.permission-row > div { display: flex; flex-direction: column; gap: 3px; }
.permission-row strong { color: #3e5a53; font-size: 10px; }
.permission-row small { color: #70817a; font-size: 9px; }
.permission-card > p { margin: 9px 0 0; color: #74827c; font-size: 9px; line-height: 1.45; }
.permission-switch { position: relative; display: inline-flex; width: 36px; height: 21px; flex: none; cursor: pointer; }
.permission-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.permission-switch span { width: 36px; height: 21px; border-radius: 99px; background: #c9d2cb; transition: background .18s ease; }
.permission-switch span::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.16); content: ''; transition: transform .18s ease; }
.permission-switch input:checked + span { background: #17616a; }
.permission-switch input:checked + span::after { transform: translateX(15px); }
.permission-switch input:focus-visible + span { outline: 2px solid #397e82; outline-offset: 3px; }
.flow-callout { flex: none; padding: 11px; border-radius: 11px; color: #40695f; background: #e2f1e8; }
.flow-callout strong { font-size: 9px; font-weight: 680; }
.flow-callout p { margin: 5px 0 0; color: #58746b; font-size: 9px; line-height: 1.45; }
.flow-kicker { margin: -3px 0 -4px; color: #6f8078; font-size: 9px; font-weight: 600; }
.flow-message-card { display: flex; flex: none; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid #e1e9e1; border-radius: 14px; background: #fff; }
.flow-message-icon { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; color: #477a70; background: #e1f0e8; }
.flow-message-icon svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.flow-message-card p { margin: 0; color: #526b65; font-size: 9px; line-height: 1.5; }
.phone-flow-subpage > .agenda-secondary { margin-top: 0; }
.safety-page { gap: 11px; }
.safety-page .flow-kicker { margin: 1px 0 -6px; }
.safety-page h1 { font-size: 20px; }
.safety-message-card { flex-direction: row; align-items: center; gap: 9px; }
.phone-flow-page button:focus-visible { outline: 2px solid #43858a; outline-offset: 2px; }
.agenda-settings-toggle:focus-visible { outline: 2px solid #43858a; outline-offset: 1px; }

@media (max-width: 390px) {
  .phone-flow-page { padding-inline: 12px; }
  .phone-flow-subpage { padding-top: 14px; }
  .agenda-greeting h1 { font-size: 20px; }
  .agenda-dose-time { width: 68px; height: 68px; }
  .agenda-dose-time strong { font-size: 14px; }
  .agenda-page { gap: 7px; }
}
