:root {
  --ink: #20213b;
  --muted: #666a80;
  --navy: #27245f;
  --violet: #7044c6;
  --blue: #5366dc;
  --sky: #dfe8ff;
  --surface: #ffffff;
  --canvas: #f4f6fb;
  --line: #e1e4ef;
  --danger: #b63f55;
  --danger-soft: #fff0f2;
  --success: #1f7a65;
  --success-soft: #e8f6f2;
  --shadow: 0 18px 48px rgba(39, 36, 95, 0.12);
  --shadow-soft: 0 8px 24px rgba(39, 36, 95, 0.08);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% -5%, rgba(83, 102, 220, 0.11), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid rgba(83, 102, 220, 0.42);
  outline-offset: 3px;
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell {
  width: min(100%, 1080px);
  min-height: 100vh;
  margin: 0 auto;
  background: rgba(244, 246, 251, 0.9);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 76px;
  padding: 10px max(18px, env(safe-area-inset-left));
  background: rgba(244, 246, 251, 0.9);
  border-bottom: 1px solid rgba(225, 228, 239, 0.8);
  backdrop-filter: blur(16px);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: auto;
  height: 52px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-button img {
  width: 36px;
  height: 46px;
  object-fit: contain;
}
.brand-button span { display: grid; gap: 1px; }
.brand-button strong { color: var(--navy); font-size: 0.82rem; line-height: 1; letter-spacing: 0.22em; }
.brand-button small { color: var(--muted); font-size: 0.62rem; line-height: 1.2; font-weight: 500; }

.alert-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(182, 63, 85, 0.22);
  border-radius: 13px;
  background: var(--danger-soft);
  color: #8f2c40;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.alert-shortcut svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

main { padding: 20px 18px calc(112px + env(safe-area-inset-bottom)); }

.view {
  display: none;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  animation: view-in 240ms ease both;
}

.view.active { display: block; }

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

.page-heading { margin: 16px 2px 26px; }
.compact-heading { margin-top: 6px; }
.page-heading h1 {
  max-width: 650px;
  margin: 4px 0 4px;
  color: var(--navy);
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}
.page-heading p { max-width: 620px; margin: 0; color: var(--muted); }

.eyebrow,
.section-kicker {
  display: block;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.section-kicker.light { color: #e3e7ff; }

.companion-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
  gap: 14px;
  min-height: 300px;
  margin-bottom: 16px;
  padding: 18px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 22% 34%, rgba(0,198,255,0.21), transparent 24%),
    radial-gradient(circle at 12% 78%, rgba(112,68,198,0.38), transparent 32%),
    linear-gradient(135deg, #080719 0%, #151039 52%, #2b185f 100%);
  color: white;
  box-shadow: var(--shadow);
}

.companion-card::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -100px;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(120, 134, 255, 0.18);
  border-radius: 50%;
}

.companion-copy { position: relative; z-index: 2; align-self: center; }
.companion-card .section-kicker { color: #c8d2ff; }
.companion-card h2 {
  margin: 7px 0 9px;
  font-size: clamp(1.12rem, 4.5vw, 1.65rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.companion-card p { margin: 0; color: rgba(255,255,255,0.74); font-size: 0.78rem; line-height: 1.5; }

.companion-habitat {
  position: relative;
  z-index: 1;
  align-self: center;
  width: 100%;
  aspect-ratio: 0.59;
  overflow: hidden;
  border: 1px solid rgba(142, 148, 255, 0.22);
  border-radius: 38% 38% 28px 28px;
  background: #030309;
  box-shadow: inset 0 0 38px rgba(102,75,255,0.26), 0 16px 38px rgba(0,0,0,0.32);
}
.companion-sprite {
  position: absolute;
  inset: -2px;
  background-color: #030309;
  background-image: url("/assets/ewe-expressions.jpg");
  background-repeat: no-repeat;
  background-size: 300% auto;
  background-position: 0% 0%;
  filter: saturate(1.04) contrast(1.02);
  transition: background-position 360ms ease, filter 360ms ease, transform 360ms ease;
}
.companion-card[data-mood="care"] .companion-sprite { background-position: 0% 100%; filter: saturate(0.9) brightness(0.86); }
.companion-card[data-mood="calm"] .companion-sprite { background-position: 0% 0%; }
.companion-card[data-mood="happy"] .companion-sprite { background-position: 50% 0%; filter: saturate(1.12) brightness(1.05); }
.companion-card[data-mood="glowing"] .companion-sprite { background-position: 100% 0%; filter: saturate(1.18) brightness(1.08); }
.companion-card.celebrate .companion-sprite { animation: companion-celebrate 900ms ease; }
.companion-orbit { position: absolute; z-index: 2; width: 8px; height: 8px; border-radius: 50%; background: #7eeaff; box-shadow: 0 0 16px 5px rgba(73,214,255,0.65); pointer-events: none; }
.orbit-one { top: 24%; left: 13%; animation: companion-float 3.8s ease-in-out infinite; }
.orbit-two { right: 12%; bottom: 18%; width: 6px; height: 6px; background: #bc8cff; animation: companion-float 4.4s ease-in-out -1.2s infinite; }
@keyframes companion-float { 50% { transform: translateY(-9px) scale(1.15); opacity: 0.65; } }
@keyframes companion-celebrate { 35% { transform: translateY(-7px) scale(1.035); filter: saturate(1.25) brightness(1.18); } 70% { transform: translateY(2px) scale(0.995); } }
.companion-energy { margin-top: 13px; }
.companion-energy-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; color: #e5e7ff; font-size: 0.68rem; font-weight: 600; }
.companion-energy-track { height: 7px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,0.14); }
.companion-energy-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #00c6ff, #9866ff, #ef8dff); box-shadow: 0 0 12px rgba(0,198,255,0.48); transition: width 450ms ease; }
.companion-tasks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.companion-tasks span { padding: 4px 7px; border: 1px solid rgba(255,255,255,0.11); border-radius: 999px; background: rgba(255,255,255,0.07); color: #b9bbd4; font-size: 0.58rem; font-weight: 600; }
.companion-tasks span.complete { border-color: rgba(98,231,206,0.28); background: rgba(49,190,158,0.16); color: #aaf4df; }
.companion-actions { display: grid; gap: 5px; margin-top: 11px; }
.companion-feed {
  min-height: 39px;
  padding: 8px 11px;
  border: 1px solid rgba(126,234,255,0.36);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,198,255,0.2), rgba(152,102,255,0.27));
  color: white;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}
.companion-feed:disabled { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5); cursor: default; }
.companion-actions > span { color: rgba(255,255,255,0.56); font-size: 0.61rem; text-align: center; }

.primary-card,
.surface-section,
.workbook-quick-card,
.grounding-card,
.contact-card,
.chart-card,
.insight-card,
.how-to-card,
.return-anchor-card,
.decision-card,
.settings-card,
.session-paper {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.primary-card {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 13px 14px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: var(--sky);
  color: var(--blue);
}
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.card-copy h2 { margin: 4px 0 3px; color: var(--navy); font-size: 1.22rem; line-height: 1.3; }
.card-copy p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.primary-card .button { grid-column: 1 / -1; }

.workbook-quick-card {
  display: grid;
  gap: 18px;
  border-color: #d7dcf0;
  background: linear-gradient(135deg, #ffffff 0%, #eef1ff 100%);
}
.workbook-quick-card h2 { margin: 5px 0 6px; color: var(--navy); font-size: 1.2rem; line-height: 1.3; }
.workbook-quick-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 15px;
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.button:active { transform: translateY(1px); }
.button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.button-block { width: 100%; }
.button-primary { background: var(--navy); color: white; box-shadow: 0 10px 22px rgba(39,36,95,0.18); }
.button-primary:hover { background: #1f1d50; }
.button-secondary { background: var(--blue); color: white; }
.button-outline { border-color: #cfd4e7; background: white; color: var(--navy); }
.button-quiet { border-color: transparent; background: #eef0f7; color: var(--navy); }
.button-light { background: white; color: var(--navy); }
.button-danger { background: var(--danger); color: white; }
.button-danger-text { border-color: rgba(182,63,85,0.2); background: var(--danger-soft); color: #982f43; }
.button.disabled { pointer-events: none; opacity: 0.46; }

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.section-heading-row h2 { margin: 4px 0 0; color: var(--navy); font-size: 1.16rem; line-height: 1.3; }
.text-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}

.pulse-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pulse-item { padding: 14px; border-radius: var(--radius-sm); background: #f6f7fc; }
.pulse-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.pulse-label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.pulse-value { color: var(--navy); font-size: 0.9rem; font-weight: 700; }
.pulse-track { height: 7px; overflow: hidden; border-radius: 8px; background: #dfe3ef; }
.pulse-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--violet)); transition: width 400ms ease; }

.daily-action-card {
  position: relative;
  min-height: 330px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--navy);
  box-shadow: var(--shadow);
  color: white;
}
.daily-action-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.daily-action-overlay { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(26,25,61,0.94) 0%, rgba(33,32,72,0.58) 57%, rgba(33,32,72,0.12) 100%); }
.daily-action-content { position: absolute; right: 0; bottom: 0; left: 0; z-index: 1; padding: 25px; }
.daily-action-content h2 { max-width: 520px; margin: 7px 0 8px; font-size: clamp(1.35rem, 5vw, 2rem); line-height: 1.18; }
.daily-action-content p { max-width: 580px; margin: 0 0 18px; color: rgba(255,255,255,0.8); font-size: 0.91rem; }
.daily-action-content .button { min-height: 45px; padding-block: 9px; }
.daily-action-content .daily-action-help { margin: -8px 0 16px; color: rgba(255,255,255,0.65); font-size: 0.72rem; }
.daily-action-buttons { display: flex; flex-wrap: wrap; gap: 9px; }
.daily-action-buttons .button { flex: 1 1 170px; }
.button-glass { border-color: rgba(255,255,255,0.3); background: rgba(18,17,50,0.34); color: white; backdrop-filter: blur(8px); }

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 6px 2px 20px;
  padding: 15px 16px;
  border: 1px solid #dfe3f4;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.56);
  color: var(--muted);
  font-size: 0.8rem;
}
.privacy-note svg { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--blue); stroke-width: 1.8; }
.privacy-note p { margin: 0; }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(100%, 1080px);
  min-height: 76px;
  margin: 0 auto;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(216,220,234,0.9);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 -8px 28px rgba(39,36,95,0.08);
  backdrop-filter: blur(16px);
}
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 58px;
  padding: 5px 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #7a7c90;
  cursor: pointer;
}
.bottom-nav button.active { background: #eef0ff; color: var(--navy); }
.bottom-nav svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.bottom-nav span { overflow: hidden; font-size: clamp(0.64rem, 2.7vw, 0.72rem); font-weight: 600; text-overflow: ellipsis; }

.grounding-card { padding: 24px; border-color: #d9ddf1; background: linear-gradient(145deg, #ffffff 0%, #eef1ff 100%); }
.grounding-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.grounding-topline h2 { margin: 5px 0 0; color: var(--navy); font-size: 1.25rem; }
.breath-time { color: var(--violet); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.breath-track { height: 9px; margin: 22px 0 14px; overflow: hidden; border-radius: 10px; background: #d9def1; }
.breath-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--violet)); transition: width 1s linear; }
.grounding-card > p { margin: 0 0 18px; color: var(--muted); }

.return-steps { display: grid; gap: 12px; margin: 20px 0; padding: 0; list-style: none; }
.return-steps li { display: grid; grid-template-columns: 54px minmax(0,1fr); gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; }
.step-number { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--navy); color: white; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; }
.return-steps h2 { margin: 0 0 3px; color: var(--navy); font-size: 1.08rem; }
.return-steps p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.guide-intro { margin: 8px 2px 18px; }
.guide-intro h2 { margin: 5px 0 5px; color: var(--navy); font-size: 1.28rem; }
.guide-intro p { margin: 0; color: var(--muted); }
.editable-steps li { align-items: start; }
.editable-steps label,
.return-anchor-card label,
.decision-card label {
  display: block;
  margin: 15px 0 7px;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 600;
}
.editable-steps textarea { min-height: 86px; }
.return-anchor-card,
.decision-card { box-shadow: var(--shadow-soft); }
.return-anchor-card h2,
.decision-card h2 { margin: 5px 0 6px; color: var(--navy); font-size: 1.25rem; line-height: 1.3; }
.return-anchor-card > p,
.decision-card > p { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }
.decision-card { border-color: #d7dcef; background: linear-gradient(145deg, #ffffff, #f3f4ff); }
.decision-guide { display: grid; gap: 8px; margin: 17px 0; }
.decision-guide p { margin: 0; padding: 12px 13px; border-left: 3px solid var(--blue); border-radius: 5px 12px 12px 5px; background: white; color: var(--muted); font-size: 0.82rem; }
.decision-guide strong { color: var(--navy); }
.escalation-note { margin-top: 17px; padding: 14px; border-left: 3px solid var(--danger); border-radius: 5px 12px 12px 5px; background: var(--danger-soft); color: #733541; font-size: 0.8rem; }

.contact-card h2 { margin: 5px 0 5px; color: var(--navy); font-size: 1.25rem; }
.contact-card > p { margin: 0 0 18px; color: var(--muted); }
.contact-actions { display: grid; gap: 10px; }
.professional-contact-list { display: grid; gap: 9px; margin: 15px 0; }
.professional-contact { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1px 12px; padding: 13px 14px; border: 1px solid #e1e4ef; border-radius: 14px; background: #f7f8fc; }
.professional-contact span { grid-column: 1 / -1; color: var(--blue); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.professional-contact strong { color: var(--navy); font-size: 0.88rem; }
.professional-contact small { align-self: center; color: var(--muted); font-size: 0.68rem; }
.contact-card .delivery-explainer { margin: 12px 0 0; color: var(--muted); font-size: 0.7rem; line-height: 1.5; }
.safety-note { margin: 20px 2px; padding: 17px 18px; border-left: 4px solid var(--danger); border-radius: 4px 14px 14px 4px; background: var(--danger-soft); color: #6d3340; font-size: 0.86rem; }

.period-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 0 0 16px; padding: 5px; border-radius: 16px; background: #e8eaf2; }
.period-switch button { min-height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.period-switch button.active { background: white; color: var(--navy); box-shadow: 0 3px 12px rgba(39,36,95,0.1); }

.how-to-card { padding: 24px; }
.how-to-card h2 { margin: 5px 0 17px; color: var(--navy); font-size: 1.25rem; line-height: 1.3; }
.use-grid { display: grid; gap: 10px; }
.use-grid > div { padding: 14px; border-radius: 14px; background: #f4f6fb; }
.use-grid strong { display: block; margin-bottom: 3px; color: var(--navy); font-size: 0.86rem; }
.use-grid p { margin: 0; color: var(--muted); font-size: 0.78rem; }
.module-heading { margin: 25px 2px 13px; }
.module-grid { display: grid; gap: 10px; }
.module-card {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 22px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 100px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  text-align: left;
  cursor: pointer;
}
.module-card:hover { border-color: #bfc7e7; transform: translateY(-1px); }
.module-number { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--navy); color: white; font-size: 0.75rem; font-weight: 700; }
.module-copy { min-width: 0; }
.module-copy strong { display: block; color: var(--navy); font-size: 0.97rem; }
.module-copy small { display: block; margin: 2px 0 6px; color: var(--muted); font-size: 0.73rem; line-height: 1.4; }
.module-copy em { display: block; color: var(--blue); font-size: 0.72rem; font-style: normal; font-weight: 600; }
.module-arrow { color: var(--violet); font-size: 1.3rem; }
.section-divider { display: flex; align-items: center; gap: 14px; margin: 34px 0 20px; color: var(--muted); font-size: 0.73rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.section-divider::before, .section-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.progress-explainer { margin: 0 2px 17px; }
.progress-explainer h2 { margin: 0 0 3px; color: var(--navy); font-size: 1.25rem; }
.progress-explainer p { margin: 0; color: var(--muted); font-size: 0.86rem; }

.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card { min-height: 124px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; box-shadow: var(--shadow-soft); }
.metric-value { display: block; margin-bottom: 6px; color: var(--navy); font-size: 1.75rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.metric-label { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.metric-detail { display: block; margin-top: 6px; color: var(--blue); font-size: 0.72rem; font-weight: 600; }

.meta-label { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.trend-chart { position: relative; min-height: 230px; overflow: hidden; border-bottom: 1px solid #d9ddea; background-image: linear-gradient(to bottom, transparent 24%, #edf0f6 25%, transparent 26%, transparent 49%, #edf0f6 50%, transparent 51%, transparent 74%, #edf0f6 75%, transparent 76%); }
.trend-chart svg { display: block; width: 100%; height: 230px; overflow: visible; }
.trend-chart .risk-line { fill: none; stroke: var(--danger); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart .connection-line { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart circle { stroke: white; stroke-width: 3; }
.trend-empty { display: grid; place-items: center; min-height: 230px; padding: 20px; color: var(--muted); text-align: center; font-size: 0.9rem; }
.chart-legend { display: flex; gap: 18px; margin-top: 14px; color: var(--muted); font-size: 0.78rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 16px; height: 3px; border-radius: 4px; }
.legend-risk { background: var(--danger); }
.legend-connection { background: var(--blue); }
.insight-card { background: var(--navy); color: white; }
.insight-card .section-kicker { color: #bcc8ff; }
.insight-card h2 { margin: 6px 0 7px; font-size: 1.22rem; }
.insight-card p { margin: 0; color: rgba(255,255,255,0.76); }

.guide-banner {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid #cfd6f0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #ffffff 0%, #eef1ff 100%);
  box-shadow: var(--shadow-soft);
}
.guide-banner .guide-character { min-height: 112px; border-radius: 17px; }
.companion-mini {
  background-color: #080715;
  background-image: url("/assets/ewe-expressions.jpg");
  background-repeat: no-repeat;
  background-size: 300% auto;
  background-position: 100% 0%;
  box-shadow: inset 0 0 22px rgba(112,68,198,0.26);
}
.guide-banner h2 { margin: 4px 0 5px; color: var(--navy); font-size: 1.08rem; line-height: 1.28; }
.guide-banner p { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.55; }
.guide-banner p strong { color: var(--navy); }

.session-phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 18px 0 12px;
  padding: 5px;
  border-radius: 16px;
  background: #e8eaf2;
}
.session-phases button {
  min-width: 0;
  min-height: 48px;
  padding: 8px 5px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.session-phases button span { display: block; margin-bottom: 1px; color: #8b8fa1; font-size: 0.62rem; letter-spacing: 0.08em; }
.session-phases button.active { background: white; color: var(--navy); box-shadow: 0 3px 12px rgba(39,36,95,0.11); }
.session-phases button.active span { color: var(--blue); }

.session-workflow {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: white;
  box-shadow: var(--shadow-soft);
}
.session-phase { display: none; }
.session-phase.active { display: block; }
.phase-heading { margin-bottom: 17px; padding-bottom: 16px; border-bottom: 1px solid #e8eaf2; }
.phase-heading h2 { margin: 4px 0 5px; color: var(--navy); font-size: 1.24rem; line-height: 1.28; }
.phase-heading p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.session-workflow label { display: block; margin: 15px 0 7px; color: var(--navy); font-size: 0.84rem; font-weight: 600; }
.session-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.session-actions.split .button { flex: 1; }
.session-summary-details { margin: 18px 0 10px; overflow: hidden; border: 1px solid #d9deef; border-radius: 15px; background: #f7f8fc; }
.session-summary-details summary { padding: 14px 16px; color: var(--navy); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.session-summary-details[open] summary { border-bottom: 1px solid #e4e7f1; }
.session-summary-details .session-paper { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.session-prefill { margin-bottom: 4px; }

.session-paper { position: relative; overflow: hidden; padding: 26px; }
.session-paper::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 6px; background: linear-gradient(90deg, var(--blue), var(--violet)); }
.session-paper h2 { margin: 5px 0 4px; color: var(--navy); font-size: 1.3rem; }
.session-paper .summary-date { margin: 0 0 20px; color: var(--muted); font-size: 0.82rem; }
.summary-list { display: grid; gap: 12px; margin: 0; }
.summary-row { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 10px; padding-bottom: 11px; border-bottom: 1px solid #eceef4; }
.summary-row:last-child { border-bottom: 0; }
.summary-row dt { color: var(--muted); font-size: 0.79rem; }
.summary-row dd { margin: 0; color: var(--ink); font-size: 0.88rem; font-weight: 500; }
.field-label, .settings-card label, .dialog-content > label, .field-stack label { display: block; margin: 15px 0 7px; color: var(--navy); font-size: 0.84rem; font-weight: 600; }
input[type="text"], input[type="tel"], input[type="time"], input[type="date"], textarea, select {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  border: 1px solid #cfd4e2;
  border-radius: 13px;
  background: white;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: 3px solid rgba(83,102,220,0.13); }
.button-stack { display: grid; gap: 10px; margin-top: 14px; }
.button-stack.compact { margin-top: 18px; }
.field-pair { display: grid; gap: 0 12px; }

.session-export, .session-history {
  margin-bottom: 16px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: white;
  box-shadow: var(--shadow-soft);
}
.session-export h2, .session-history h2 { margin: 4px 0 0; color: var(--navy); font-size: 1.12rem; }
.session-history .section-heading-row { margin-bottom: 13px; }
.session-history-list { display: grid; gap: 9px; }
.session-history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 68px;
  padding: 13px 14px;
  border: 1px solid #dde1ed;
  border-radius: 14px;
  background: #f8f9fc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.session-history-card strong { display: block; color: var(--navy); font-size: 0.84rem; }
.session-history-card span { display: block; margin-top: 2px; color: var(--muted); font-size: 0.72rem; }
.session-history-card em { color: var(--blue); font-size: 0.72rem; font-style: normal; font-weight: 600; }
.session-history-empty { margin: 0; padding: 14px; border-radius: 14px; background: #f6f7fb; color: var(--muted); font-size: 0.8rem; }
.app-version { margin: 18px 0 0; color: #8b8fa1; font-size: 0.72rem; text-align: center; }

.settings-card h2 { margin: 0 0 5px; color: var(--navy); font-size: 1.18rem; }
.settings-card > p { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }
.settings-card small { display: block; margin-top: 11px; color: var(--muted); font-size: 0.74rem; line-height: 1.55; }
.guide-access-card { display: grid; gap: 14px; border-color: #d7dcf3; background: linear-gradient(135deg, #fff, #f0f3ff); }
.guide-access-card .button { margin: 0; }
.settings-privacy { margin-top: 4px; }
.optional-label { color: var(--muted); font-weight: 400; }
.settings-divider { display: flex; align-items: center; gap: 10px; margin: 22px 0 4px; color: var(--blue); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.settings-divider::after { content: ""; flex: 1; height: 1px; background: #e2e5ef; }

dialog { border: 0; }
dialog::backdrop { background: rgba(24,23,52,0.68); backdrop-filter: blur(5px); }
.sheet-dialog {
  width: min(100%, 720px);
  max-width: none;
  max-height: 100dvh;
  margin: auto 0 0;
  padding: 0;
  overflow: hidden;
  border-radius: 26px 26px 0 0;
  background: white;
  color: var(--ink);
  box-shadow: 0 -24px 70px rgba(25,24,61,0.3);
}
.dialog-content { max-height: 100dvh; padding: 28px 20px calc(26px + env(safe-area-inset-bottom)); overflow-y: auto; }
.dialog-content h1 { margin: 5px 0 8px; color: var(--navy); font-size: clamp(1.65rem, 7vw, 2.35rem); line-height: 1.15; letter-spacing: -0.03em; }
.dialog-content > p { margin: 0 0 20px; color: var(--muted); }
.dialog-content .dialog-intro { font-size: 0.86rem; line-height: 1.55; }
.onboarding-brand { display: flex; justify-content: center; height: 84px; margin: -4px 0 15px; }
.onboarding-brand img { width: 64px; height: 84px; object-fit: contain; }
.onboarding-grid { display: grid; gap: 2px 12px; }
.dialog-content label span { color: var(--muted); font-weight: 400; }
.dialog-privacy { margin: 18px 0; }
.action-option-list { display: grid; gap: 9px; }
.action-option { position: relative; display: block; cursor: pointer; }
.action-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.action-option > span { display: block; padding: 14px 15px; border: 1px solid #d9ddea; border-radius: 15px; background: #fafbfe; transition: all 150ms ease; }
.action-option strong { display: block; color: var(--navy); font-size: 0.86rem; }
.action-option small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.action-option input:checked + span { border-color: var(--blue); background: #eef0ff; box-shadow: inset 0 0 0 1px var(--blue); }
.action-option input:focus-visible + span { outline: 3px solid rgba(83,102,220,0.28); outline-offset: 2px; }
.danger-kicker { color: var(--danger); }
.alert-contact-grid { display: grid; gap: 10px; margin: 18px 0; }
.alert-contact-button { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 13px; align-items: center; min-height: 88px; padding: 14px; border: 1px solid #dce0ee; border-radius: 17px; background: #f9faff; text-decoration: none; }
.alert-contact-button:hover { border-color: #bcc5ea; }
.alert-contact-button.disabled { opacity: 0.58; }
.alert-contact-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: #eef0ff; color: var(--blue); }
.alert-contact-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.alert-contact-icon img { width: 28px; height: 36px; object-fit: contain; }
.alert-contact-button small, .alert-contact-button strong, .alert-contact-button em { display: block; }
.alert-contact-button small { color: var(--blue); font-size: 0.63rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.alert-contact-button strong { color: var(--navy); font-size: 0.92rem; }
.alert-contact-button em { margin-top: 2px; color: var(--muted); font-size: 0.7rem; font-style: normal; }
.alert-delivery-status { margin: 0 0 14px; padding: 12px 13px; border-radius: 12px; background: #f0f2f8; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.compact-safety { margin: 16px 0 0; font-size: 0.74rem; }

.guide-dialog { width: min(100%, 760px); }
.guide-step-list { display: grid; gap: 9px; margin: 18px 0; }
.guide-step-list article { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 12px; align-items: start; padding: 13px; border: 1px solid #dfe3f1; border-radius: 15px; background: #fafbfe; }
.guide-step-list article > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--navy); color: white; font-size: 0.7rem; font-weight: 700; }
.guide-step-list strong { display: block; color: var(--navy); font-size: 0.88rem; }
.guide-step-list p { margin: 3px 0 0; color: var(--muted); font-size: 0.77rem; line-height: 1.5; }
.guide-tamagotchi { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 14px; align-items: center; margin: 18px 0; padding: 15px; border-radius: 17px; background: linear-gradient(135deg, #0b0922, #2b185f); color: white; }
.guide-tamagotchi p { margin: 0; color: rgba(255,255,255,0.76); font-size: 0.77rem; line-height: 1.55; }
.guide-tamagotchi strong { color: white; }
.guide-ewe { width: 92px; height: 126px; border-radius: 30px 30px 20px 20px; background-color: #030309; background-image: url("/assets/ewe-expressions.jpg"); background-repeat: no-repeat; background-size: 300% auto; background-position: 50% 0; box-shadow: inset 0 0 22px rgba(112,68,198,0.32); }

.workbook-dialog { width: min(100%, 860px); }
.workbook-content { min-height: min(100dvh, 820px); }
.workbook-header { margin-bottom: 18px; }
.module-intro { margin-bottom: 20px; padding: 17px; border-radius: 16px; background: #eff2ff; }
.module-intro h2 { margin: 3px 0 5px; color: var(--navy); font-size: 1.15rem; }
.module-intro p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.workbook-form label { display: block; margin: 15px 0 7px; color: var(--navy); font-size: 0.83rem; font-weight: 600; }
.workbook-form .button { margin-top: 20px; }
.workbook-field { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.workbook-field + .workbook-field { margin-top: 10px; }
.workbook-field label { margin-top: 0; }
.pillar-list { display: grid; gap: 10px; }
.pillar-card {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 22px;
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.pillar-index { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #eef0ff; color: var(--navy); font-size: 0.73rem; font-weight: 700; }
.pillar-card strong { display: block; color: var(--navy); font-size: 0.9rem; line-height: 1.35; }
.pillar-card p { margin: 4px 0 7px; color: var(--muted); font-size: 0.73rem; line-height: 1.45; }
.pillar-card em { color: var(--blue); font-size: 0.7rem; font-style: normal; font-weight: 600; }
.pillar-card .module-arrow { align-self: center; }
.model-workflow { display: grid; gap: 9px; margin: 0 0 18px; }
.model-workflow-step { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 11px; align-items: start; padding: 13px; border: 1px solid #dce1f1; border-radius: 14px; background: white; }
.model-workflow-step > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--navy); color: white; font-size: 0.7rem; font-weight: 700; }
.model-workflow-step strong { display: block; color: var(--navy); font-size: 0.84rem; }
.model-workflow-step p { margin: 2px 0 0; color: var(--muted); font-size: 0.74rem; }
.model-note { margin: 0 0 18px; padding: 13px 14px; border-left: 3px solid var(--violet); border-radius: 5px 13px 13px 5px; background: #f1efff; color: #4b4671; font-size: 0.79rem; }
.pillar-status { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 999px; background: #eef1ff; color: var(--blue); font-size: 0.68rem; font-style: normal; font-weight: 600; }
.pillar-status.followup { background: var(--success-soft); color: var(--success); }
.back-button { margin: -2px 0 16px; padding-inline: 0; background: transparent; color: var(--blue); }
.pillar-hero { margin-bottom: 18px; padding: 20px; border-radius: 18px; background: linear-gradient(135deg, var(--navy), #51409d); color: white; }
.pillar-hero .section-kicker { color: #c8d2ff; }
.pillar-hero h2 { margin: 5px 0 7px; font-size: 1.35rem; line-height: 1.25; }
.pillar-hero p { margin: 0; color: rgba(255,255,255,0.78); font-size: 0.84rem; }
.example-box { margin: 13px 0 0; padding: 13px; border: 1px solid rgba(255,255,255,0.16); border-radius: 13px; background: rgba(255,255,255,0.08); font-size: 0.77rem; }
.example-box strong { display: block; margin-bottom: 2px; color: #d5dcff; font-size: 0.69rem; letter-spacing: 0.08em; text-transform: uppercase; }
.objective-card { margin-bottom: 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: white; }
.objective-card summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 58px; padding: 14px 16px; color: var(--navy); font-size: 0.9rem; font-weight: 600; cursor: pointer; list-style: none; }
.objective-card summary::-webkit-details-marker { display: none; }
.objective-card summary::after { content: "+"; color: var(--blue); font-size: 1.2rem; }
.objective-card[open] summary::after { content: "−"; }
.objective-fields { padding: 0 16px 18px; border-top: 1px solid #edf0f6; }
.objective-fields label { margin-top: 13px; }
.field-explain { display: block; margin: -3px 0 8px; color: var(--muted); font-size: 0.73rem; line-height: 1.48; }
.action-frequency { display: grid; gap: 9px; }
.stage-block { margin-top: 16px; padding: 18px; border: 1px solid #d9deef; border-radius: 18px; background: #f7f8fc; }
.stage-block.session-stage { border-color: #cfd7f2; background: #f0f3ff; }
.stage-block.followup-stage { border-color: #d4e8e2; background: #f3faf8; }
.stage-heading { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 12px; align-items: start; margin-bottom: 10px; }
.stage-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--navy); color: white; font-size: 0.72rem; font-weight: 700; }
.followup-stage .stage-number { background: var(--success); }
.stage-heading h2 { margin: 1px 0 3px; color: var(--navy); font-size: 1.02rem; }
.stage-heading p { margin: 0; color: var(--muted); font-size: 0.77rem; }
.section-block { margin-top: 18px; padding: 18px; border: 1px solid #d9deef; border-radius: 18px; background: #f6f7fc; }
.section-block h2 { margin: 4px 0 5px; color: var(--navy); font-size: 1.12rem; }
.section-block > p { margin: 0 0 13px; color: var(--muted); font-size: 0.8rem; }
.week-list { display: grid; gap: 10px; }
.week-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 74px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 16px; background: white; color: var(--navy); text-align: left; cursor: pointer; }
.week-card strong { display: block; }
.week-card span { color: var(--muted); font-size: 0.75rem; }
.week-card em { color: var(--blue); font-size: 0.73rem; font-style: normal; font-weight: 600; }
.worksheet-subhead { margin: 24px 0 10px; padding-bottom: 8px; border-bottom: 2px solid #e4e7f2; }
.worksheet-subhead h2 { margin: 4px 0 4px; color: var(--navy); font-size: 1.12rem; }
.worksheet-subhead p { margin: 0; color: var(--muted); font-size: 0.79rem; }
.check-list.compact { grid-template-columns: repeat(2, minmax(0,1fr)); }
.check-list.compact span { min-height: 46px; padding-left: 42px; font-size: 0.78rem; }
.form-save-bar { position: sticky; bottom: calc(-26px - env(safe-area-inset-bottom)); z-index: 3; margin: 24px -20px calc(-26px - env(safe-area-inset-bottom)); padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,0.96); backdrop-filter: blur(12px); }

.checkin-content { display: flex; flex-direction: column; min-height: min(100dvh, 760px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-header h1 { margin-bottom: 0; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 14px; background: #f0f1f6; color: var(--navy); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.step-progress { width: 100%; height: 6px; margin: 18px 0 24px; overflow: hidden; border-radius: 8px; background: #e4e7f0; }
.step-progress span { display: block; width: 33.333%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--violet)); transition: width 240ms ease; }
.form-step { display: none; flex: 1; }
.form-step.active { display: block; }
fieldset { min-width: 0; margin: 0 0 22px; padding: 0; border: 0; }
legend { width: 100%; margin-bottom: 14px; color: var(--navy); font-size: 1.1rem; font-weight: 600; line-height: 1.35; }
legend small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.choice-grid { display: grid; gap: 10px; }
.status-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.choice-grid label, .check-list label { position: relative; cursor: pointer; }
.choice-grid input, .check-list input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-grid span { display: grid; place-items: center; min-height: 52px; padding: 10px 12px; border: 1px solid #d7dbe8; border-radius: 14px; background: white; color: var(--muted); font-size: 0.85rem; font-weight: 500; text-align: center; transition: all 150ms ease; }
.choice-grid input:checked + span { border-color: var(--blue); background: #eef0ff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--blue); }
.choice-grid input:focus-visible + span, .check-list input:focus-visible + span { outline: 3px solid rgba(83,102,220,0.28); outline-offset: 2px; }
.slider-fieldset { padding-top: 4px; }
.range-row { display: grid; grid-template-columns: 1fr 34px; gap: 7px 12px; margin-bottom: 17px; color: var(--ink); font-size: 0.88rem; font-weight: 500; }
.range-row output { justify-self: end; color: var(--navy); font-weight: 700; }
.range-row input { grid-column: 1 / -1; width: 100%; height: 26px; margin: 0; accent-color: var(--blue); }
.field-help { margin: -7px 0 15px; color: var(--muted); font-size: 0.82rem; }
.check-list { display: grid; gap: 9px; }
.check-list span { display: flex; align-items: center; min-height: 50px; padding: 10px 14px 10px 46px; border: 1px solid #d7dbe8; border-radius: 14px; background: white; color: var(--ink); font-size: 0.87rem; }
.check-list span::before { content: ""; position: absolute; left: 16px; width: 18px; height: 18px; border: 1.5px solid #aeb4c8; border-radius: 5px; }
.check-list input:checked + span { border-color: var(--blue); background: #f1f3ff; color: var(--navy); }
.check-list input:checked + span::before { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 4px #f1f3ff; }
.field-stack label:first-child { margin-top: 0; }
.dialog-actions { position: sticky; bottom: calc(-26px - env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 10px; margin: 24px -20px calc(-26px - env(safe-area-inset-bottom)); padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,0.96); backdrop-filter: blur(12px); }
.dialog-actions .button { flex: 1; }

.success-dialog, .confirm-dialog { width: min(calc(100% - 32px), 460px); padding: 0; border-radius: 24px; background: white; color: var(--ink); box-shadow: var(--shadow); }
.success-content, .confirm-content { padding: 28px; text-align: center; }
.success-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.success-mark svg { width: 31px; height: 31px; fill: none; stroke: currentColor; stroke-width: 2; }
.success-content h1 { margin: 6px 0 8px; color: var(--navy); font-size: 1.55rem; line-height: 1.2; }
.success-content p, .confirm-content p { margin: 0 0 20px; color: var(--muted); }
.success-content .button + .button { margin-top: 9px; }
.confirm-content h2 { margin: 0 0 8px; color: var(--navy); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast { position: fixed; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); left: 16px; z-index: 80; max-width: 440px; margin: 0 auto; padding: 13px 16px; border-radius: 14px; background: #1f1e48; color: white; box-shadow: var(--shadow); font-size: 0.85rem; font-weight: 500; text-align: center; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 700px) {
  .topbar { padding-inline: 30px; }
  main { padding: 34px 30px 122px; }
  .companion-card { grid-template-columns: 235px minmax(0,1fr); min-height: 340px; padding: 28px; gap: 26px; }
  .companion-card p { font-size: 0.88rem; }
  .companion-tasks span { font-size: 0.66rem; }
  .pulse-grid { grid-template-columns: repeat(4, 1fr); }
  .primary-card { grid-template-columns: 56px minmax(0,1fr) auto; align-items: center; padding: 25px; }
  .primary-card .button { grid-column: auto; width: auto; min-width: 220px; }
  .workbook-quick-card { grid-template-columns: minmax(0,1fr) auto; align-items: center; }
  .workbook-quick-card .button { width: auto; }
  .daily-action-card { min-height: 390px; }
  .contact-actions { grid-template-columns: 1fr 1fr; }
  .metrics-grid { grid-template-columns: repeat(4,1fr); }
  .onboarding-grid { grid-template-columns: 1fr 1fr; }
  .field-pair { grid-template-columns: 1fr 1fr; }
  .use-grid { grid-template-columns: repeat(2,1fr); }
  .module-grid { grid-template-columns: repeat(2,1fr); }
  .action-frequency { grid-template-columns: repeat(3,1fr); }
  .model-workflow { grid-template-columns: repeat(3,1fr); }
  .guide-banner { grid-template-columns: 120px minmax(0,1fr); padding: 20px; }
  .guide-banner .guide-character { min-height: 134px; }
  .session-workflow { padding: 28px; }
  .session-export { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 18px; align-items: center; }
  .session-export .button-stack { margin-top: 0; }
  .sheet-dialog { margin: auto; border-radius: 26px; }
  .dialog-content { max-height: min(88dvh, 820px); padding: 34px; }
  .dialog-actions { bottom: -34px; margin: 28px -34px -34px; padding: 16px 34px 22px; }
  .form-save-bar { bottom: -34px; margin: 26px -34px -34px; padding: 16px 34px 22px; }
}

@media (min-width: 1050px) {
  .app-shell { display: grid; grid-template-columns: 190px minmax(0,1fr); grid-template-rows: 82px 1fr; min-height: calc(100vh - 28px); margin: 14px auto; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: var(--canvas); box-shadow: 0 26px 70px rgba(39,36,95,0.13); }
  .topbar { grid-column: 1 / -1; position: sticky; min-height: 82px; }
  main { grid-column: 2; grid-row: 2; height: calc(100vh - 110px); overflow-y: auto; padding: 34px 36px 60px; }
  .bottom-nav { position: static; grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: stretch; width: auto; min-height: 0; padding: 22px 12px; border-top: 0; border-right: 1px solid var(--line); background: #fff; box-shadow: none; }
  .bottom-nav button { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 11px; min-height: 48px; padding: 9px 13px; }
  .bottom-nav span { font-size: 0.78rem; }
  .toast { bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  body { background: white; }
  .topbar, .bottom-nav, .page-heading, .guide-banner, .session-phases, .session-actions, .session-export, .session-history, .session-prefill, .view:not(#view-session) { display: none !important; }
  .app-shell, main, #view-session { display: block !important; width: 100%; height: auto; margin: 0; padding: 0; overflow: visible; border: 0; box-shadow: none; }
  .session-workflow, .session-paper { margin: 0; border: 0; box-shadow: none; }
  #view-session .session-phase[hidden], #view-session .session-phase { display: block !important; break-inside: avoid; margin-bottom: 24px; }
  .session-summary-details { display: block; }
  .session-summary-details summary { display: none; }
}
