.sleep-profile-app {
  --page-bg: #070d18;
  --surface-bg: rgba(10, 16, 31, 0.82);
  --surface-bg-strong: rgba(9, 15, 29, 0.92);
  --surface-line: rgba(217, 222, 255, 0.12);
  --surface-line-strong: rgba(226, 231, 255, 0.17);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-soft-strong: rgba(255, 255, 255, 0.08);
  --text-main: rgba(246, 247, 255, 0.98);
  --text-soft: rgba(225, 228, 244, 0.9);
  --text-muted: rgba(180, 190, 219, 0.82);
  --text-dim: rgba(150, 162, 196, 0.74);
  --lavender: #b8a7ff;
  --lavender-strong: #d6ccff;
  --lavender-soft: rgba(184, 167, 255, 0.14);
  --peach: #f4b38a;
  --peach-soft: rgba(244, 179, 138, 0.12);
  --success-soft: rgba(140, 224, 184, 0.14);
  --danger-soft: rgba(255, 138, 160, 0.14);
  --shadow-main:
    0 26px 76px rgba(0, 0, 0, 0.36),
    0 12px 28px rgba(124, 104, 215, 0.08);
}

.sleep-profile-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(173, 153, 255, 0.16), transparent 34%),
    radial-gradient(circle at 88% 16%, rgba(242, 182, 142, 0.08), transparent 24%),
    radial-gradient(circle at 48% 100%, rgba(111, 92, 210, 0.1), transparent 40%),
    linear-gradient(180deg, #0a1120 0%, #080f1c 48%, #060b15 100%);
}

.sleep-profile-body .community-app {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.sleep-shell-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 18px;
  padding: 18px 20px;
  border: 1px solid var(--surface-line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(15, 22, 40, 0.88), rgba(10, 15, 29, 0.95)),
    rgba(10, 15, 29, 0.88);
  box-shadow: var(--shadow-main);
  backdrop-filter: blur(16px);
}

.sleep-shell-brand {
  display: grid;
  gap: 8px;
}

.sleep-shell-kicker {
  margin: 0;
  color: rgba(205, 197, 255, 0.82);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sleep-shell-brand h1 {
  margin: 0;
  color: var(--text-main);
  font-size: clamp(1.7rem, 2.3vw, 2.45rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.sleep-shell-copy {
  margin: 0;
  max-width: 62ch;
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.66;
}

.sleep-shell-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.sleep-profile-body .home-link,
.sleep-profile-body .toolbar-button,
.sleep-profile-body .action-button,
.sleep-profile-body .sleep-json-panel summary {
  touch-action: manipulation;
}

.sleep-shell-main {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.sleep-intro-strip,
.sleep-flow-surface,
.sleep-sidebar,
.sleep-result-surface {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--surface-line);
  background:
    linear-gradient(180deg, rgba(14, 20, 37, 0.88), rgba(10, 15, 28, 0.94)),
    rgba(10, 15, 28, 0.9);
  box-shadow: var(--shadow-main);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.sleep-intro-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
}

.sleep-intro-pill {
  display: grid;
  gap: 7px;
  min-height: 94px;
  padding: 16px 18px;
  border: 1px solid rgba(231, 233, 255, 0.09);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.sleep-intro-label {
  color: rgba(205, 197, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sleep-intro-pill strong {
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.sleep-flow-surface {
  display: grid;
  gap: 18px;
  padding: 22px 24px 20px;
  border-radius: 30px;
}

.sleep-flow-head {
  display: grid;
  gap: 8px;
}

.sleep-flow-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sleep-step-indicator,
.sleep-stage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--surface-line);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(227, 220, 255, 0.92);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sleep-flow-head h2 {
  margin: 0;
  max-width: 17ch;
  color: var(--text-main);
  font-size: clamp(1.76rem, 2.5vw, 2.34rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.sleep-flow-description {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.65;
}

.sleep-storage-meta {
  display: grid;
  gap: 10px;
  max-width: 68ch;
}

.sleep-storage-policy-copy,
.sleep-status-message {
  margin: 0;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  line-height: 1.55;
}

.sleep-storage-policy-copy {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
}

.sleep-status-message {
  color: rgba(228, 232, 255, 0.96);
  background: rgba(184, 167, 255, 0.12);
  border-color: rgba(214, 204, 255, 0.2);
}

.sleep-step-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.sleep-step-tab {
  display: grid;
  gap: 7px;
  align-content: start;
  min-height: 82px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  cursor: pointer;
  touch-action: manipulation;
}

.sleep-step-tab.is-active {
  border-color: rgba(213, 204, 255, 0.22);
  background: linear-gradient(180deg, rgba(192, 178, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sleep-step-tab.is-complete .sleep-step-tab-index {
  background: rgba(166, 239, 198, 0.18);
  color: #c9ffe0;
}

.sleep-step-tab-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
}

.sleep-step-tab-label {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
}

.sleep-survey-form {
  display: grid;
  gap: 18px;
}

.sleep-step-content {
  display: grid;
  gap: 14px;
}

.sleep-question-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.sleep-inline-input-wrap {
  display: grid;
}

.sleep-inline-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font: inherit;
}

.sleep-inline-input::placeholder {
  color: var(--text-dim);
}

.sleep-inline-input:focus-visible {
  outline: none;
  border-color: rgba(220, 213, 255, 0.24);
  box-shadow:
    0 0 0 3px rgba(184, 167, 255, 0.14),
    0 12px 24px rgba(113, 96, 193, 0.12);
}

.sleep-question-head {
  display: grid;
  gap: 6px;
}

.sleep-question-head h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.04rem;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.sleep-question-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.55;
}

.sleep-question-card.is-error {
  border-color: rgba(255, 146, 170, 0.34);
  box-shadow: 0 0 0 1px rgba(255, 146, 170, 0.18);
}

.sleep-inline-error {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 146, 170, 0.3);
  border-radius: 18px;
  background: rgba(255, 138, 160, 0.08);
  color: #ffd7df;
}

.sleep-inline-error strong,
.sleep-inline-error p {
  margin: 0;
}

.sleep-inline-error p {
  color: rgba(255, 221, 230, 0.92);
  font-size: 0.9rem;
  line-height: 1.55;
}

.sleep-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  gap: 10px;
}

.sleep-option-stack {
  display: grid;
  gap: 14px;
}

.sleep-option-grid.is-four-scale {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sleep-option-aux-row {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.sleep-option-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

.sleep-option-card.is-aux {
  justify-content: flex-start;
  min-height: 44px;
  width: fit-content;
  max-width: min(220px, 100%);
  padding: 10px 14px;
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.018);
  color: var(--text-dim);
  text-align: left;
  box-shadow: none;
}

.sleep-option-card.is-selected {
  border-color: rgba(220, 213, 255, 0.22);
  background: linear-gradient(180deg, rgba(188, 173, 255, 0.16), rgba(255, 255, 255, 0.06));
  color: var(--text-main);
  box-shadow:
    0 10px 22px rgba(113, 96, 193, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sleep-option-card.is-aux.is-selected {
  border-color: rgba(220, 213, 255, 0.16);
  background: linear-gradient(180deg, rgba(188, 173, 255, 0.11), rgba(255, 255, 255, 0.04));
  color: rgba(229, 225, 247, 0.95);
  box-shadow:
    0 8px 18px rgba(113, 96, 193, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sleep-option-card:focus-visible,
.sleep-chip:focus-visible {
  outline: none;
  border-color: rgba(220, 213, 255, 0.24);
  box-shadow:
    0 0 0 3px rgba(184, 167, 255, 0.14),
    0 12px 24px rgba(113, 96, 193, 0.1);
}

.sleep-option-value {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.sleep-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.sleep-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.sleep-chip.is-active,
.sleep-chip.is-passive {
  border-color: rgba(220, 213, 255, 0.2);
  background: rgba(186, 171, 255, 0.14);
  color: var(--lavender-strong);
}

.sleep-chip.is-disabled,
.sleep-chip:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.sleep-empty-copy {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.55;
}

.sleep-flow-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sleep-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
}

.sleep-sidebar-block {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.sleep-sidebar-block h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.18rem;
  line-height: 1.35;
  letter-spacing: -0.03em;
}

.sleep-sidebar-copy {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.62;
}

.sleep-note-list,
.sleep-detail-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  line-height: 1.7;
}

.sleep-result-surface {
  grid-column: 1 / -1;
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 30px;
}

.sleep-result-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
}

.sleep-result-summary {
  margin: 8px 0 0;
  max-width: 64ch;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.66;
}

.sleep-result-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.sleep-meta-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.sleep-meta-label {
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sleep-meta-card strong {
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.4;
}

.sleep-flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sleep-flag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--peach-soft);
  border: 1px solid rgba(244, 179, 138, 0.22);
  color: #ffd8bf;
  font-size: 0.84rem;
  font-weight: 700;
}

.sleep-flag-pill.is-soft {
  background: rgba(184, 167, 255, 0.12);
  border-color: rgba(184, 167, 255, 0.18);
  color: rgba(232, 228, 255, 0.88);
}

.sleep-top-subtypes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sleep-subtype-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(214, 206, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.sleep-subtype-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.sleep-subtype-card.is-primary {
  background:
    linear-gradient(180deg, rgba(188, 173, 255, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.03);
  border-color: rgba(220, 213, 255, 0.18);
}

.sleep-subtype-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sleep-subtype-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.sleep-subtype-confidence.high {
  color: #d6ffe7;
}

.sleep-subtype-confidence.medium {
  color: #ffe2b8;
}

.sleep-subtype-confidence.low {
  color: #ffd0da;
}

.sleep-subtype-card h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.08rem;
  line-height: 1.45;
}

.sleep-subtype-card strong {
  color: var(--lavender-strong);
  font-size: 1.46rem;
  line-height: 1;
}

.sleep-subtype-evidence {
  margin: -2px 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.5;
}

.sleep-info-gap-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 207, 155, 0.32);
  background: rgba(255, 196, 120, 0.12);
  color: #ffe5be;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sleep-coverage-note {
  margin: -2px 0 0;
  color: rgba(255, 227, 193, 0.82);
  font-size: 0.76rem;
  line-height: 1.5;
}

.sleep-subtype-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.sleep-domain-grid,
.sleep-explanation-grid,
.sleep-output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sleep-first-actions-panel {
  grid-column: 1 / -1;
}

.sleep-domain-panel,
.sleep-explanation-card,
.sleep-output-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
}

.sleep-timing-panel {
  grid-column: 1 / -1;
}

.sleep-panel-head {
  display: grid;
  gap: 6px;
}

.sleep-panel-head h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.08rem;
  line-height: 1.35;
}

.sleep-panel-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.58;
}

.sleep-panel-note {
  color: rgba(213, 207, 246, 0.82);
}

.sleep-result-adjustment-note {
  margin: 10px 0 0;
  color: rgba(255, 227, 193, 0.9);
  font-size: 0.84rem;
  line-height: 1.55;
}

.sleep-safety-priority-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 191, 141, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 186, 122, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
}

.sleep-safety-priority-panel .sleep-action-card {
  border-color: rgba(255, 196, 144, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 201, 147, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.025);
}

.sleep-flag-pill.is-urgent {
  border-color: rgba(255, 196, 144, 0.22);
  background: rgba(255, 196, 144, 0.12);
  color: rgba(255, 234, 214, 0.95);
}

.sleep-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sleep-filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
  touch-action: manipulation;
}

.sleep-filter-chip:hover,
.sleep-filter-chip:focus-visible,
.sleep-filter-chip.is-active {
  border-color: rgba(214, 204, 255, 0.24);
  background: rgba(184, 167, 255, 0.12);
  color: rgba(242, 238, 255, 0.96);
}

.sleep-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sleep-action-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(214, 204, 255, 0.14);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(188, 173, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
}

.sleep-action-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sleep-action-slot,
.sleep-action-evidence {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.sleep-action-slot {
  background: rgba(184, 167, 255, 0.16);
  border: 1px solid rgba(184, 167, 255, 0.2);
  color: rgba(238, 234, 255, 0.92);
}

.sleep-action-evidence {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.sleep-action-card h4 {
  margin: 0;
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

.sleep-action-fit {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.58;
}

.sleep-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sleep-action-meta span {
  color: rgba(255, 228, 196, 0.86);
  font-size: 0.78rem;
  line-height: 1.5;
}

.sleep-action-caution-row,
.sleep-timing-caution-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sleep-action-caution {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 168, 0.18);
  background: rgba(255, 214, 168, 0.08);
  color: rgba(255, 236, 210, 0.94);
  font-size: 0.74rem;
  line-height: 1.45;
}

.sleep-source-link-row,
.sleep-reference-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sleep-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(184, 167, 255, 0.18);
  background: rgba(184, 167, 255, 0.08);
  color: rgba(234, 228, 255, 0.92);
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
  touch-action: manipulation;
}

.sleep-source-link:hover,
.sleep-source-link:focus-visible {
  background: rgba(184, 167, 255, 0.14);
  border-color: rgba(214, 204, 255, 0.28);
  transform: translateY(-1px);
}

.sleep-reference-grid {
  display: grid;
}

.sleep-reference-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.sleep-reference-copy {
  display: grid;
  gap: 4px;
}

.sleep-reference-copy strong {
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.sleep-reference-copy p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.5;
}

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

.sleep-timing-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.025);
}

.sleep-timing-list {
  display: grid;
  gap: 10px;
}

.sleep-timing-row {
  display: grid;
  gap: 8px;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sleep-timing-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.sleep-timing-row-copy {
  display: grid;
  gap: 4px;
}

.sleep-timing-row-copy h4 {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.sleep-timing-row-copy p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.5;
}

.sleep-timing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sleep-timing-meta span {
  color: rgba(232, 227, 252, 0.88);
  font-size: 0.74rem;
  line-height: 1.45;
}

.sleep-timing-caution-row .sleep-action-caution {
  border-color: rgba(255, 214, 168, 0.15);
  background: rgba(255, 214, 168, 0.06);
}

.sleep-empty-state {
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.018);
}

.sleep-radar-wrap {
  display: grid;
  place-items: center;
  padding: 4px;
}

#domain-radar {
  width: min(100%, 360px);
  height: auto;
}

.sleep-radar-grid {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.sleep-radar-axis {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
}

.sleep-radar-fill {
  fill: rgba(184, 167, 255, 0.18);
  stroke: rgba(214, 204, 255, 0.84);
  stroke-width: 2;
}

.sleep-radar-core {
  fill: rgba(255, 255, 255, 0.78);
}

.sleep-radar-label {
  fill: rgba(228, 231, 244, 0.9);
  font-size: 12px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.sleep-domain-cards {
  display: grid;
  gap: 10px;
}

.sleep-domain-card {
  display: grid;
  gap: 10px;
}

.sleep-domain-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.sleep-domain-copy h3,
.sleep-domain-copy p {
  margin: 0;
}

.sleep-domain-titleblock {
  display: grid;
  gap: 4px;
}

.sleep-domain-copy h3 {
  color: var(--text-soft);
  font-size: 0.94rem;
  font-weight: 700;
}

.sleep-domain-scoreline {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.sleep-domain-scoreline p {
  color: var(--lavender-strong);
  font-size: 0.92rem;
  font-weight: 800;
}

.sleep-domain-delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.sleep-domain-delta.is-up {
  background: rgba(255, 193, 128, 0.12);
  border: 1px solid rgba(255, 193, 128, 0.18);
  color: #ffd8ab;
}

.sleep-domain-delta.is-down {
  background: rgba(181, 238, 211, 0.12);
  border: 1px solid rgba(181, 238, 211, 0.16);
  color: #d8ffe9;
}

.sleep-domain-card.is-info-gap .sleep-domain-meter span {
  background: linear-gradient(90deg, rgba(255, 198, 132, 0.52), rgba(244, 179, 138, 0.82));
}

.sleep-domain-meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sleep-domain-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(184, 167, 255, 0.58), rgba(244, 179, 138, 0.82));
}

.mini-checkin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mini-checkin-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-checkin-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.mini-checkin-head-copy {
  display: grid;
  gap: 4px;
}

.mini-checkin-head strong {
  color: var(--text-main);
  font-size: 0.92rem;
}

.mini-checkin-head-copy p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.76rem;
  line-height: 1.4;
}

.mini-checkin-fields {
  display: grid;
  gap: 10px;
}

.mini-checkin-impact {
  display: grid;
}

.mini-checkin-impact-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(214, 204, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.028);
}

.mini-checkin-impact-card.is-idle {
  border-color: rgba(255, 255, 255, 0.07);
}

.mini-checkin-impact-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mini-checkin-impact-head strong {
  color: var(--text-main);
  font-size: 0.94rem;
}

.mini-checkin-impact-head span {
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mini-checkin-impact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-checkin-impact-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(184, 167, 255, 0.1);
  border: 1px solid rgba(184, 167, 255, 0.14);
  color: rgba(237, 231, 255, 0.9);
  font-size: 0.76rem;
  line-height: 1.4;
}

.mini-checkin-impact-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.mini-checkin-toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.45;
  touch-action: manipulation;
}

.mini-checkin-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #b8a7ff;
}

.sleep-json-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.sleep-json-panel summary {
  padding: 14px 16px;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.sleep-json-output {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1040px) {
  .sleep-shell-main {
    grid-template-columns: 1fr;
  }

  .sleep-sidebar {
    position: static;
  }

  .sleep-step-tabs,
  .sleep-top-subtypes,
  .sleep-intro-strip,
  .sleep-domain-grid,
  .sleep-explanation-grid,
  .sleep-output-grid,
  .mini-checkin-grid,
  .sleep-action-grid,
  .sleep-timing-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sleep-profile-body .community-app {
    width: min(100%, calc(100% - 16px));
    padding: 12px 0 24px;
    gap: 12px;
  }

  .sleep-shell-header,
  .sleep-flow-surface,
  .sleep-sidebar,
  .sleep-result-surface {
    border-radius: 24px;
  }

  .sleep-shell-header {
    grid-template-columns: 1fr;
    padding: 18px 16px;
  }

  .sleep-shell-actions {
    justify-content: stretch;
  }

  .sleep-shell-actions .home-link,
  .sleep-shell-actions .toolbar-button {
    flex: 1 1 0;
  }

  .sleep-intro-strip {
    padding: 12px;
  }

  .sleep-flow-surface,
  .sleep-result-surface {
    padding: 18px 16px;
  }

  .sleep-flow-head h2 {
    max-width: none;
    font-size: 1.68rem;
  }

  .sleep-option-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sleep-option-grid.is-four-scale {
    grid-template-columns: 1fr 1fr;
  }

  .sleep-option-aux-row {
    gap: 8px;
  }

  .sleep-option-card.is-aux {
    max-width: min(220px, 100%);
  }

  .sleep-flow-actions {
    flex-direction: column;
  }

  .sleep-flow-actions .toolbar-button,
  .sleep-flow-actions .action-button {
    width: 100%;
  }

  .sleep-result-meta {
    grid-template-columns: 1fr;
  }

  .sleep-reference-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
