:root {
  --paper: #f6f0e7;
  --surface: #fffaf2;
  --surface-2: #f1e8dc;
  --ink: #173633;
  --muted: #68777a;
  --line: #d9cec0;
  --coral: #d86f55;
  --moss: #6a8c74;
  --gold: #d8a641;
  --blue: #5a7d8c;
  --pale-coral: #f4d8cc;
  --pale-moss: #dde7da;
  --pale-gold: #f3e6bd;
  --pale-blue: #dde9ed;
  --white: #ffffff;
  --shadow: 0 24px 80px rgba(23, 54, 51, 0.16);
  color-scheme: light;
  font-family: Inter, Aptos, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(216, 111, 85, 0.08), transparent 30%),
    linear-gradient(135deg, #f8f1e8 0%, #edf3ee 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  background: #143431;
  color: var(--white);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand strong {
  display: block;
  font-size: 24px;
}

.brand small,
.sidebar-note span {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: #f9eee4;
  position: relative;
}

.brand-mark span {
  position: absolute;
  width: 20px;
  height: 28px;
  border: 3px solid var(--coral);
  border-radius: 20px 20px 6px 6px;
  top: 9px;
}

.brand-mark span:first-child {
  left: 10px;
  transform: rotate(-32deg);
}

.brand-mark span:last-child {
  right: 10px;
  transform: rotate(32deg);
  border-color: var(--moss);
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-btn,
.primary-btn,
.text-link,
.segmented button,
.mood-row button {
  border: 0;
  border-radius: 12px;
}

.nav-item {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  text-align: left;
  overflow: hidden;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-note strong {
  display: block;
  margin-bottom: 8px;
}

.content {
  padding: 36px clamp(20px, 4vw, 56px) 64px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  margin-bottom: 0;
}

h2 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  margin-bottom: 14px;
}

h3 {
  font-size: 23px;
  line-height: 1.18;
  margin-bottom: 10px;
}

.lead {
  color: #33484c;
  font-size: 18px;
  line-height: 1.55;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 22px;
  margin-bottom: 22px;
}

.hero-panel,
.daily-panel,
.content-panel,
.result-panel,
.summary-card,
.cycle-map,
.admin-panel,
.research-card,
.source-panel,
.exercise-runner {
  border: 1px solid rgba(23, 54, 51, 0.12);
  background: rgba(255, 250, 242, 0.92);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 430px;
  border-radius: 28px;
  background:
    linear-gradient(110deg, rgba(20, 52, 49, 0.98) 0%, rgba(20, 52, 49, 0.88) 62%, rgba(216, 111, 85, 0.1) 100%),
    var(--ink);
  color: var(--white);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
  align-items: center;
  padding: 42px;
  overflow: hidden;
}

.hero-copy p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 18px;
  line-height: 1.55;
}

.status-pill,
.soft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill {
  background: rgba(216, 166, 65, 0.18);
  color: #f3d37b;
  margin-bottom: 24px;
}

.soft-badge {
  background: var(--pale-moss);
  color: var(--ink);
}

.phone-preview {
  width: 224px;
  min-height: 382px;
  border: 11px solid #102c2a;
  border-radius: 34px;
  background: var(--surface);
  padding: 42px 18px 18px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.phone-camera {
  position: absolute;
  width: 66px;
  height: 7px;
  border-radius: 999px;
  background: #23504b;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.phone-card {
  color: var(--ink);
  padding: 16px;
  border-radius: 18px;
  margin-bottom: 14px;
}

.phone-card small,
.phone-card span {
  display: block;
  font-size: 12px;
}

.phone-card strong {
  display: block;
  margin: 6px 0 8px;
  font-size: 17px;
}

.accent-moss {
  background: var(--pale-moss);
}

.accent-coral {
  background: var(--pale-coral);
}

.phone-progress {
  height: 9px;
  background: #e7ded0;
  border-radius: 999px;
  margin-top: 16px;
  overflow: hidden;
}

.phone-progress span {
  display: block;
  width: 46%;
  height: 100%;
  background: var(--coral);
}

.daily-panel,
.content-panel,
.result-panel,
.summary-card,
.cycle-map,
.admin-panel,
.research-card,
.source-panel,
.exercise-runner {
  border-radius: 22px;
  padding: 26px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.mood-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.mood-row button,
.segmented button {
  background: var(--surface-2);
  color: var(--ink);
  padding: 11px 12px;
  font-weight: 800;
}

.mood-row button.active,
.segmented button.active {
  background: var(--ink);
  color: var(--white);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  font-weight: 800;
  font-size: 14px;
}

.compact-field {
  margin-bottom: 10px;
}

.compact-field input {
  min-height: 40px;
  padding: 10px 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 4px rgba(106, 140, 116, 0.14);
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 900;
}

.primary-btn {
  color: var(--white);
  background: var(--ink);
}

.primary-btn:hover {
  background: #214945;
}

.ghost-btn {
  color: var(--ink);
  background: rgba(255, 250, 242, 0.72);
  border: 1px solid rgba(23, 54, 51, 0.12);
}

.text-link {
  padding: 0;
  color: var(--coral);
  background: transparent;
  font-weight: 900;
  text-align: left;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.summary-card {
  min-height: 218px;
  display: flex;
  flex-direction: column;
}

.summary-card p {
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
}

.tile-icon {
  width: 40px;
  height: 40px;
  color: var(--coral);
  margin-bottom: 16px;
}

.split-layout,
.cycle-layout,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
}

.assessment-list {
  display: grid;
  gap: 14px;
}

.question-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.question-card p {
  font-weight: 800;
  margin-bottom: 14px;
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(42px, 1fr));
  gap: 8px;
}

.scale label {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 12px;
  background: var(--surface-2);
  font-weight: 900;
}

.scale input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale label:has(input:checked) {
  background: var(--ink);
  color: var(--white);
}

.result-panel {
  position: sticky;
  top: 24px;
  align-self: start;
}

.axis-card {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.axis-card > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-weight: 800;
}

.bar {
  height: 12px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--coral);
  transition: width 300ms ease;
}

.recommendation-box,
.safety-result {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: var(--pale-gold);
  color: var(--ink);
  line-height: 1.45;
}

.cycle-form {
  display: grid;
}

.cycle-map {
  min-height: 600px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.92), rgba(241, 232, 220, 0.74));
}

.cycle-map::before {
  content: "";
  position: absolute;
  inset: 120px 72px 190px;
  border: 3px solid rgba(216, 111, 85, 0.55);
  border-radius: 44%;
}

.cycle-node,
.cycle-core,
.cycle-request {
  position: absolute;
  border-radius: 18px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(23, 54, 51, 0.08);
}

.cycle-node small,
.cycle-core span,
.cycle-request span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.cycle-node strong,
.cycle-core strong,
.cycle-request strong {
  display: block;
  line-height: 1.25;
}

.cycle-node.top {
  top: 70px;
  left: 50%;
  width: 230px;
  transform: translateX(-50%);
  background: var(--pale-gold);
}

.cycle-node.right {
  top: 245px;
  right: 36px;
  width: 210px;
  background: var(--pale-coral);
}

.cycle-node.bottom {
  bottom: 130px;
  left: 50%;
  width: 230px;
  transform: translateX(-50%);
  background: var(--pale-blue);
}

.cycle-node.left {
  top: 245px;
  left: 36px;
  width: 210px;
  background: var(--pale-moss);
}

.cycle-core {
  width: 220px;
  top: 266px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  text-align: center;
}

.cycle-core span {
  color: rgba(255, 255, 255, 0.7);
}

.cycle-request {
  left: 36px;
  right: 36px;
  bottom: 32px;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  background: rgba(255, 250, 242, 0.75);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.exercise-grid,
.event-list,
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.exercise-card,
.event-card {
  border: 1px solid rgba(23, 54, 51, 0.12);
  border-radius: 22px;
  padding: 22px;
  background: rgba(255, 250, 242, 0.92);
  box-shadow: 0 16px 46px rgba(23, 54, 51, 0.1);
}

.exercise-card h3,
.event-card h3 {
  min-height: 54px;
}

.exercise-card p,
.event-card p,
.research-card p {
  color: var(--muted);
  line-height: 1.48;
}

.meta-row,
.tag-row,
.event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row {
  margin: 14px 0;
}

.chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.exercise-runner {
  margin-top: 24px;
}

.exercise-runner ol {
  display: grid;
  gap: 12px;
  padding-left: 24px;
}

.exercise-runner li {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  line-height: 1.45;
}

.timer-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.timer-display {
  font-size: 28px;
  font-weight: 900;
}

.event-card.featured {
  background: linear-gradient(135deg, var(--surface), var(--pale-moss));
}

.event-actions a,
.event-actions button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-panel {
  align-self: start;
}

.admin-item {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.admin-item:last-child {
  border-bottom: 0;
}

.admin-item h4 {
  margin: 0 0 6px;
  font-size: 17px;
}

.admin-item p {
  margin: 0 0 12px;
  color: var(--muted);
}

.panel-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

.compact-head {
  align-items: center;
  margin-bottom: 10px;
}

.compact-head h3 {
  margin-bottom: 0;
}

.small-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.assessment-item {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.assessment-item:last-child {
  border-bottom: 0;
}

.assessment-item h4 {
  margin: 0;
  font-size: 16px;
}

.assessment-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.score-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.score-pair span {
  display: block;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 900;
}

.danger-link {
  color: #a6442e;
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 900;
}

.research-card {
  min-height: 180px;
}

.source-panel {
  margin-top: 20px;
}

.source-panel li {
  margin: 10px 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 28, 27, 0.56);
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 50;
}

.modal {
  width: min(840px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border-radius: 26px;
  padding: 28px;
  background: var(--surface);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.28);
}

.safety-list {
  display: grid;
  gap: 12px;
}

.safety-question {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
}

.safety-question p {
  margin: 0;
  font-weight: 800;
}

.switch-row {
  display: inline-flex;
  gap: 8px;
}

.switch-row label {
  min-width: 54px;
  text-align: center;
  border-radius: 999px;
  padding: 8px 10px;
  background: var(--surface-2);
  font-weight: 900;
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch-row label:has(input:checked) {
  background: var(--ink);
  color: var(--white);
}

.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  background: currentColor;
  mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
}

[data-icon="home"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 10.5 12 3l9 7.5V21h-6v-6H9v6H3z'/%3E%3C/svg%3E");
}

[data-icon="compass"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm4 6-2.2 5.8L8 16l2.2-5.8L16 8Z'/%3E%3C/svg%3E");
}

[data-icon="cycle"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.7 6.3A8 8 0 0 0 4.3 9H2l3.5 4L9 9H6.4a6 6 0 0 1 10-1.3l1.3-1.4ZM22 15l-3.5-4L15 15h2.6a6 6 0 0 1-10 1.3l-1.3 1.4A8 8 0 0 0 19.7 15H22Z'/%3E%3C/svg%3E");
}

[data-icon="spark"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 2 2.2 6.5L21 11l-6.8 2.5L12 20l-2.2-6.5L3 11l6.8-2.5L12 2Z'/%3E%3C/svg%3E");
}

[data-icon="calendar"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 2h2v3h6V2h2v3h3v17H4V5h3V2Zm13 9H6v9h14v-9Z'/%3E%3C/svg%3E");
}

[data-icon="settings"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m19.4 13.5 2-1.5-2-1.5.3-2.5-2.5-.6-1.3-2.2-2.3 1-2.3-1L10 7.4 7.5 8l.3 2.5-2 1.5 2 1.5L7.5 16l2.5.6 1.3 2.2 2.3-1 2.3 1 1.3-2.2 2.5-.6-.3-2.5ZM13.6 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z'/%3E%3C/svg%3E");
}

[data-icon="book"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 3h11a3 3 0 0 1 3 3v15H8a3 3 0 0 0-3-3V3Zm3 2v11.1c.3-.1.7-.1 1-.1h8V6a1 1 0 0 0-1-1H8Z'/%3E%3C/svg%3E");
}

[data-icon="shield"] {
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2 20 5v6c0 5-3.4 9.4-8 11-4.6-1.6-8-6-8-11V5l8-3Zm0 4.1L7 8v3c0 3.5 2 6.6 5 8 3-1.4 5-4.5 5-8V8l-5-1.9Z'/%3E%3C/svg%3E");
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 8px 8px;
    height: auto;
    z-index: 30;
    padding: 8px;
    border-radius: 22px;
    box-shadow: var(--shadow);
  }

  .brand,
  .sidebar-note {
    display: none;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }

  .nav-item {
    justify-content: center;
    padding: 9px 4px;
    font-size: 10px;
    flex-direction: column;
    gap: 4px;
  }

  .nav-item .icon {
    width: 18px;
    height: 18px;
  }

  .nav-item[data-view="research"] {
    display: none;
  }

  .content {
    padding-bottom: 112px;
  }

  .hero-grid,
  .split-layout,
  .cycle-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .overview-grid,
  .exercise-grid,
  .event-list,
  .research-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 740px) {
  .content {
    padding: 22px 14px 112px;
  }

  .topbar,
  .section-head {
    flex-direction: column;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    padding: 26px;
  }

  .phone-preview {
    margin: 0 auto;
  }

  .overview-grid,
  .exercise-grid,
  .event-list,
  .research-grid,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .main-nav {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .cycle-map {
    min-height: 660px;
  }

  .cycle-node.left,
  .cycle-node.right {
    left: 28px;
    right: 28px;
    width: auto;
  }

  .cycle-node.right {
    top: 338px;
  }

  .cycle-core {
    top: 250px;
  }

  .cycle-node.bottom {
    bottom: 128px;
  }

  .cycle-map::before {
    inset: 112px 52px 180px;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segmented button {
    white-space: nowrap;
  }
}
