:root {
  --forest: #1F5F4A;
  --forest-dark: #154536;
  --sage-bg: #EEF4EE;
  --card: #FFFFFF;
  --ink: #233A33;
  --ink-soft: #5C7269;
  --mild: #F5D97A;
  --mild-bg: #FCF3D8;
  --mod: #EFA24B;
  --mod-bg: #FBE6CE;
  --severe: #D8483E;
  --severe-bg: #F7DEDB;
  --none: #5FA987;
  --line: #DCE7E0;
  --shadow: 0 18px 40px -18px rgba(31, 95, 74, .35)
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  padding: 0;
  touch-action: manipulation;
  overscroll-behavior: none
}

body {
  background: radial-gradient(circle at 15% 10%, #E4EFE6 0%, transparent 45%), radial-gradient(circle at 85% 90%, #DCEAE0 0%, transparent 50%), var(--sage-bg);
  font-family: 'Sarabun', 'Noto Sans Thai', Tahoma, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 16px 60px;
  line-height: 1.55
}

a {
  color: inherit
}

.lab {
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  color: var(--forest-dark);
  letter-spacing: .02em;
  text-align: center;
  margin-bottom: 6px;
  font-size: 22px
}

.sub-lab {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 28px
}

.app-frame {
  width: 340px;
  height: 700px;
  background: #0d1613;
  border-radius: 46px;
  padding: 12px;
  box-shadow: var(--shadow);
  position: relative
}

.screen {
  width: 100%;
  height: 100%;
  background: var(--sage-bg);
  border-radius: 36px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column
}

.notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 22px;
  background: #0d1613;
  border-radius: 14px;
  z-index: 30
}

.status {
  height: 40px;
  flex-shrink: 0
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: 8px
}

.topbar {
  padding: 6px 20px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0
}

.back-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--forest);
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
  cursor: pointer;
  border: none;
  text-decoration: none
}

.topbar h2 {
  font-family: 'Prompt', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--forest-dark);
  margin: 0
}

.home-head {
  padding: 26px 22px 18px;
  flex-shrink: 0
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px
}

.brandmark img{
  width:40px;
  height:40px;
  display:block;
  object-fit:contain;
}

.brandmark .icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px
}

.brandmark .name {
  font-family: 'Prompt', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--forest-dark)
}

.tagline {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-left: 48px
}

.menu-grid {
  padding: 6px 20px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

.menu-card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 20px -14px rgba(31, 95, 74, .4);
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform .15s ease;
  text-decoration: none
}

.menu-card:active {
  transform: scale(.97)
}

.menu-card .m-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--sage-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px
}

.menu-card .m-title {
  font-family: 'Prompt', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3
}

.redflag-banner {
  margin: 14px 20px 0;
  background: linear-gradient(120deg, #FBE1DE, #F7CFCB);
  border: 1px solid #EFB4AE;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none
}

.redflag-banner .rf-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--severe);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0
}

.redflag-banner .rf-text {
  flex: 1;
  line-height: 1.35
}

.redflag-banner .rf-title {
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  color: #8A2E27
}

.redflag-banner .rf-sub {
  font-size: 11px;
  color: #9C4E48
}

.redflag-banner .rf-arrow {
  color: #8A2E27;
  font-size: 16px
}

.home-illustration {
  margin: 20px 20px 0;
  border-radius: 18px;
  background: linear-gradient(150deg, #22705A, #154536);
  padding: 18px;
  color: #EFF7F2;
  position: relative;
  overflow: hidden
}

.home-illustration::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07)
}

.home-illustration h4 {
  font-family: 'Prompt', sans-serif;
  font-size: 13.5px;
  margin: 0 0 6px;
  font-weight: 600
}

.home-illustration p {
  font-size: 11.5px;
  margin: 0;
  color: #CFE4D9;
  line-height: 1.5
}

.bottom-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px 16px;
  background: var(--card);
  border-top: 1px solid var(--line)
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #9AAAA2;
  cursor: pointer;
  text-decoration: none
}

.nav-item .n-icon {
  font-size: 17px
}

.nav-item.active {
  color: var(--forest)
}

.guide-list,
.clinical-list {
  padding: 4px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px
}

.guide-row,
.clinical-card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none
}

.guide-row .arrow,
.clinical-card .arrow {
  color: var(--forest)
}

.guide-detail {
  padding: 0 20px 20px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft)
}

.guide-detail h5 {
  font-family: 'Prompt', sans-serif;
  color: var(--forest-dark);
  font-size: 13px;
  margin: 14px 0 4px
}

.guide-detail ul {
  margin: 4px 0;
  padding-left: 18px
}

.guide-detail li {
  margin-bottom: 4px
}

.howto-list {
  padding: 2px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px
}

.step-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px
}

.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px
}

.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Prompt', sans-serif;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0
}

.step-title {
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--forest-dark)
}

.step-body {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.65;
  padding-left: 36px
}

.step-body b {
  color: var(--ink)
}

.step-body ul {
  margin: 4px 0;
  padding-left: 16px
}

.step-body li {
  margin-bottom: 3px
}

.step-tag {
  display: inline-block;
  margin: 4px 0 0 36px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Prompt', sans-serif
}

.clinical-card {
  justify-content: flex-start;
  gap: 12px
}

.clinical-card .c-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--sage-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0
}

.clinical-card .c-title {
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--forest-dark)
}

.clinical-card .c-sub {
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-top: 2px
}

.ladder-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px
}

.ladder-step {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Prompt', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0
}

.ladder-body {
  flex: 1
}

.ladder-title {
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 2px
}

.ladder-drugs {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.5
}

.drug-pill {
  display: inline-block;
  background: var(--sage-bg);
  color: var(--forest-dark);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  margin: 1px 2px 1px 0
}

.clinical-section {
  margin-bottom: 12px
}

.clinical-section h5 {
  font-family: 'Prompt', sans-serif;
  color: var(--forest-dark);
  font-size: 12.5px;
  margin: 0 0 4px
}

.clinical-section p,
.clinical-section li {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 4px
}

.clinical-section ul {
  margin: 2px 0;
  padding-left: 16px
}

.warn-box {
  background: var(--severe-bg);
  border: 1px solid #ECB6B0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 10.5px;
  color: #8A3A34;
  line-height: 1.55;
  margin-top: 6px
}

.warn-box b {
  color: #7A2A24
}

.drug-group {
  margin-bottom: 14px
}

.drug-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--forest-dark);
  margin-bottom: 6px
}

.drug-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0
}

.drug-entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  margin-bottom: 6px
}

.drug-name {
  font-family: 'Prompt', sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--ink)
}

.drug-use {
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 1px;
  line-height: 1.4
}

.bodymap-wrap {
  padding: 4px 20px 10px;
  flex: 1;
  display: flex;
  flex-direction: column
}

.bodymap-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 14px
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 16px
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  cursor: pointer
}

.check-row:last-child {
  border-bottom: none
}

.check-row input {
  display: none
}

.box {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 1.6px solid #B9CCC1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 12px;
  flex-shrink: 0
}

.check-row input:checked+.box {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff
}

.check-row:has(input:checked) {
  color: var(--forest-dark);
  font-weight: 600
}

.primary-btn {
  background: var(--forest);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 10px 20px -10px rgba(31, 95, 74, .6);
  text-decoration: none;
  text-align: center
}

.primary-btn:active {
  transform: scale(.98)
}

.primary-btn.ghost {
  background: transparent;
  color: var(--forest);
  border: 1.6px solid var(--forest);
  box-shadow: none
}

.primary-btn.danger {
  background: var(--severe);
  box-shadow: 0 10px 20px -10px rgba(216, 72, 62, .6)
}

.slider-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 20px 14px
}

.slider-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 20px;
  text-align: center
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 24px
}

.scale-track {
  width: 40px;
  height: 280px;
  position: relative;
  touch-action: none;
  cursor: grab
}

.scale-track:active {
  cursor: grabbing
}

.scale-track-fill {
  position: absolute;
  left: 50%;
  top: 0;
  width: 14px;
  height: 280px;
  border-radius: 10px;
  background: linear-gradient(to top, var(--none) 0%, var(--none) 6%, var(--mild) 8%, var(--mild) 34%, var(--mod) 36%, var(--mod) 64%, var(--severe) 66%, var(--severe) 100%);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0
}

.vslider {
  position: absolute;
  width: 40px;
  height: 280px;
  top: 0;
  left: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  touch-action: none;
  z-index: 2
}

.thumb {
  position: absolute;
  left: 50%;
  width: 34px;
  height: 34px;
  background: #fff;
  border: 3px solid var(--forest);
  border-radius: 50%;
  transform: translate(-50%, 50%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Prompt', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--forest-dark)
}

.scale-track {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
  position: relative;
  z-index: 1
}

.scale-track * {
  touch-action: none
}

@media(max-width:600px) {
  .slider-row {
    gap: 18px
  }

  .slider-hint {
    padding: 0 8px
  }

  .slider-wrap {
    padding-left: 14px;
    padding-right: 14px
  }
}

.scale-numbers {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  height: 280px;
  font-size: 10.5px;
  color: var(--ink-soft);
  font-family: 'Prompt', sans-serif
}

.score-big {
  text-align: center;
  margin-bottom: 20px
}

.score-big .num {
  font-family: 'Prompt', sans-serif;
  font-size: 44px;
  font-weight: 700;
  color: var(--forest-dark);
  line-height: 1
}

.score-big .lvl-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: 'Prompt', sans-serif
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px
}

.chip {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.4px solid var(--line);
  background: var(--card);
  font-size: 12px;
  cursor: pointer
}

.chip.sel {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest)
}

.result-card {
  margin: 6px 20px 14px;
  border-radius: 20px;
  padding: 22px 20px;
  text-align: center
}

.result-card .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin: 0 auto 10px
}

.result-card .r-label {
  font-size: 12px;
  color: var(--ink-soft)
}

.result-card .r-score {
  font-family: 'Prompt', sans-serif;
  font-size: 34px;
  font-weight: 700;
  margin: 4px 0
}

.result-card .r-tag {
  font-family: 'Prompt', sans-serif;
  font-size: 12.5px;
  font-weight: 600
}

.advice-box {
  margin: 0 20px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-soft)
}

.advice-box b {
  color: var(--ink)
}

.advice-box .warn {
  color: var(--severe);
  font-weight: 600;
  margin-top: 8px;
  display: block
}

.result-actions {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-bottom: 10px
}

.log-list {
  padding: 6px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px
}

.log-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--mod);
  border-radius: 14px;
  padding: 13px 15px
}

.log-row .l-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px
}

.log-row .l-date {
  font-size: 11.5px;
  color: var(--ink-soft)
}

.log-row .l-score {
  font-family: 'Prompt', sans-serif;
  font-weight: 700;
  font-size: 13px
}

.log-row .l-detail {
  font-size: 11.5px;
  color: var(--ink-soft)
}

.trend-pill {
  display: inline-block;
  margin-top: 6px;
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600
}

.rf-view {
  padding: 8px 20px 20px
}

.rf-alert-box {
  background: var(--severe-bg);
  border: 1px solid #ECB6B0;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 18px
}

.rf-alert-box p {
  margin: 0 0 8px;
  font-size: 12px;
  color: #7A2A24;
  font-weight: 600
}

.rf-alert-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: #8A3A34;
  line-height: 1.9
}

.call-btn {
  background: var(--severe);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 18px;
  width: 100%;
  font-family: 'Prompt', sans-serif;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 14px 26px -12px rgba(216, 72, 62, .55);
  text-decoration: none
}

.call-btn:active {
  transform: scale(.98)
}

.rf-note {
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 14px
}

.alert {
  margin: 0 20px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 11px
}

.alert.error {
  background: var(--severe-bg);
  border: 1px solid #ECB6B0;
  color: #8A3A34
}

.alert.success {
  background: #E4F4EA;
  border: 1px solid #BBD9C8;
  color: #2E6B4F
}

.alert.info {
  background: var(--sage-bg);
  border: 1px solid var(--line);
  color: var(--forest-dark)
}

.reminder-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  max-width: 400px;
  margin: 0 auto;
  background: var(--forest);
  color: #fff;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-family: 'Sarabun', 'Noto Sans Thai', Tahoma, sans-serif;
  animation: reminder-toast-in .25s ease-out
}

.reminder-toast b {
  display: block;
  font-size: 14px;
  margin-bottom: 4px
}

.reminder-toast p {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  opacity: .95
}

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

.reminder-toast button {
  border: 0;
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer
}

.reminder-toast .toast-go {
  flex: 1;
  background: #fff;
  color: var(--forest)
}

.reminder-toast .toast-dismiss {
  background: rgba(255, 255, 255, .18);
  color: #fff
}

@keyframes reminder-toast-in {
  from {
    opacity: 0;
    transform: translateY(12px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.auth-view {
  flex: 1;
  overflow: auto;
  padding: 0 20px 20px
}

.pin-step-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 2px
}

.pin-step {
  font-size: 12px;
  font-weight: 600;
  color: var(--forest-dark);
  text-align: center
}

.pin-back-btn {
  position: absolute;
  left: 0;
  background: transparent;
  border: none;
  color: var(--forest);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
  cursor: pointer
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 22px
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  transition: background .12s ease, border-color .12s ease, transform .12s ease
}

.pin-dot.filled {
  background: var(--forest);
  border-color: var(--forest);
  transform: scale(1.08)
}

.pin-dot.shake-row {
  animation: pin-shake .35s ease
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0) }
  20% { transform: translateX(-6px) }
  40% { transform: translateX(6px) }
  60% { transform: translateX(-4px) }
  80% { transform: translateX(4px) }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 300px;
  margin: 0 auto
}

.keypad-btn {
  height: 60px;
  width: 60px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: 'Prompt', sans-serif;
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px -2px rgba(21, 69, 54, .12);
  transition: background .1s ease, transform .1s ease
}

.keypad-btn:active {
  background: var(--sage-bg);
  transform: scale(.95)
}

.keypad-btn.empty {
  visibility: hidden;
  box-shadow: none;
  border: none
}

.keypad-btn.action {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--ink-soft);
  font-size: 15px
}

.keypad-btn.action svg {
  width: 22px;
  height: 22px
}

.auth-card {
  padding: 22px 0
}

.auth-card .brandmark {
  justify-content: center;
  margin-bottom: 14px
}

.auth-card .tagline {
  text-align: center;
  margin: 0
}

.auth-card h1 {
  font-family: 'Prompt', sans-serif;
  font-size: 20px;
  color: var(--forest-dark);
  text-align: center;
  margin: 18px 0 4px
}

.auth-card p {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center
}

.form {
  display: flex;
  flex-direction: column;
  gap: 11px
}

.form label {
  font-size: 11px;
  color: var(--ink);
  font-weight: 600
}

.form input,
.form textarea,
.form select {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 11px 12px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  outline: none
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  border-color: #8ABAA2;
  box-shadow: 0 0 0 3px #E4F1E9
}

.form small {
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 400
}

.auth-links {
  text-align: center;
  font-size: 11px !important
}

.auth-links a {
  color: var(--forest);
  font-weight: 700;
  text-decoration: none
}

.footer-note {
  font-size: 9px;
  color: #91A29A;
  text-align: center;
  padding: 5px 18px 10px
}

.logout-form {
  position: absolute;
  right: 16px;
  top: 48px;
  z-index: 5
}

.logout-btn {
  background: transparent;
  border: 0;
  color: #8B9B94;
  font-size: 9px;
  cursor: pointer
}

.flash-space {
  height: 0
}

@media(max-width:380px) {
  body {
    padding: 0
  }

  .app-frame {
    width: 100%;
    max-width: 340px;
    height: 100vh;
    height: 100dvh;
    min-height: 650px;
    border-radius: 0;
    padding: 0
  }

  .screen {
    border-radius: 0
  }

  .notch {
    top: 0
  }

  .status {
    height: 34px
  }
}

.chip input {
  display: none
}

.chip:has(input:checked) {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest)
}

.assessment-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 4px 20px 16px;
  flex: 1
}

.assessment-form label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink)
}

.assessment-form input,
.assessment-form textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  outline: none;
  resize: vertical
}

.assessment-form input:focus,
.assessment-form textarea:focus {
  border-color: #8ABAA2;
  box-shadow: 0 0 0 3px #E4F1E9
}

.form-section-title {
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  color: var(--forest-dark);
  font-size: 13px
}

.form-help {
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.55
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

.info-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.6
}

.info-card b {
  color: var(--forest-dark)
}

.sticky-action {
  margin-top: auto;
  padding-top: 8px
}

.page-actions {
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px
}

.page-actions .primary-btn {
  display: block
}

.view {
  scroll-behavior: smooth
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--sage-bg) 92%, transparent);
  backdrop-filter: blur(7px)
}

@supports not (background:color-mix(in srgb, white 50%, black)) {
  .topbar {
    background: var(--sage-bg)
  }
}

.l-extra {
  font-size: 10.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-top: 5px
}

.nav-item.active {
  font-weight: 600
}

.nav-item:focus-visible,
.primary-btn:focus-visible,
.guide-row:focus-visible,
.menu-card:focus-visible,
.back-btn:focus-visible {
  outline: 3px solid #A9CDBA;
  outline-offset: 2px
}

/* ===== Real responsive web app layout =====
   The reference design is used for visual language only.
   On desktop there is NO phone/device frame. The same UI becomes a full-width website.
*/
body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  margin: 0;
  display: block;
  background: radial-gradient(circle at 15% 5%, #E4EFE6 0%, transparent 40%), radial-gradient(circle at 90% 90%, #DCEAE0 0%, transparent 45%), var(--sage-bg);
}

.app-frame {
  width: 100%;
  max-width: none;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.notch {
  display: none
}

.status {
  height: 0
}

.view {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 0;
  overflow: visible;
}

.home-head,
.menu-grid,
.redflag-banner,
.home-illustration,
.bodymap-wrap,
.slider-wrap,
.chip-row,
.result-card,
.advice-box,
.result-actions,
.log-list,
.rf-view,
.auth-view,
.guide-list,
.clinical-list,
.howto-list,
.page-actions,
.assessment-form {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.home-head {
  padding: 48px 32px 24px
}

.menu-grid {
  padding: 8px 32px 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px
}

.menu-card {
  padding: 22px 20px;
  min-height: 145px;
  justify-content: center
}

.menu-card .m-icon {
  width: 46px;
  height: 46px;
  font-size: 22px
}

.menu-card .m-title {
  font-size: 16px
}

.redflag-banner {
  margin-top: 18px;
  margin-left: auto;
  margin-right: auto;
  padding: 18px 22px;
  max-width: 1016px
}

.home-illustration {
  margin-top: 22px;
  padding: 24px 26px;
  max-width: 1016px
}

.home-illustration h4 {
  font-size: 16px
}

.home-illustration p {
  font-size: 13px
}

.bottom-nav {
  width: 100%;
  max-width: 1280px;
  margin: 30px auto 0;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  position: relative;
}

.nav-item {
  font-size: 12px;
  min-width: 90px;
  padding: 5px 14px;
  border-radius: 10px
}

.nav-item:hover {
  background: var(--sage-bg);
  color: var(--forest)
}

.topbar {
  padding: 14px 32px 16px
}

.logout-form {
  top: 18px;
  right: 32px;
  position: absolute
}

.logout-btn {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--forest-dark)
}

.auth-view {
  padding: 56px 32px 32px;
  max-width: 720px
}

.auth-card {
  padding: 30px 0
}

.auth-card h1 {
  font-size: 28px
}

.auth-card p {
  font-size: 14px
}

.form input,
.form textarea,
.form select {
  font-size: 14px;
  padding: 13px 14px
}

.form label {
  font-size: 13px
}

.primary-btn {
  font-size: 15px;
  padding: 14px 18px
}

.guide-list,
.clinical-list,
.howto-list,
.log-list {
  padding: 10px 32px 32px
}

.guide-row,
.clinical-card {
  font-size: 14px;
  padding: 17px 20px
}

.guide-detail {
  max-width: 1000px;
  margin: auto;
  padding: 0 32px 32px;
  font-size: 14px
}

.page-actions {
  padding: 0 32px 28px
}

.alert {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto
}

@media (min-width:900px) {
  .menu-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr))
  }

  .menu-card {
    min-height: 170px
  }

  .home-head {
    display: flex;
    align-items: flex-end;
    gap: 20px
  }

  .tagline {
    margin-left: 0;
    margin-bottom: 5px
  }

  .assessment-form {
    max-width: 900px
  }

  .slider-wrap {
    max-width: 720px
  }

  .result-card {
    max-width: 720px
  }

  .advice-box {
    max-width: 720px
  }

  .result-actions {
    max-width: 720px
  }

  .log-list {
    max-width: 900px
  }
}

@media (max-width:899px) {
  .view {
    max-width: none
  }

  .home-head {
    padding: 32px 20px 18px
  }

  .menu-grid {
    padding: 6px 20px 8px
  }

  .redflag-banner,
  .home-illustration {
    margin-left: 20px;
    margin-right: 20px
  }

  .bottom-nav {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin-top: 20px
  }

  .topbar {
    padding-left: 20px;
    padding-right: 20px
  }

  .logout-form {
    right: 20px;
    top: 12px
  }

  .logout-btn {
    font-size: 10px;
    padding: 6px 9px
  }

  .auth-view {
    padding-left: 20px;
    padding-right: 20px
  }

  .guide-list,
  .clinical-list,
  .howto-list,
  .log-list {
    padding-left: 20px;
    padding-right: 20px
  }

  .guide-detail {
    padding-left: 20px;
    padding-right: 20px
  }

  .page-actions {
    padding-left: 20px;
    padding-right: 20px
  }
}

@media (max-width:600px) {
  .home-head {
    padding-top: 28px
  }

  .menu-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px
  }

  .menu-card {
    min-height: 125px;
    padding: 15px 13px
  }

  .menu-card .m-title {
    font-size: 13px
  }

  .redflag-banner {
    padding: 14px 15px
  }

  .home-illustration {
    padding: 18px
  }

  .bottom-nav {
    padding: 9px 5px calc(12px + env(safe-area-inset-bottom));
  }

  .nav-item {
    font-size: 10px;
    min-width: 0;
    padding: 4px 8px
  }

  .nav-item .n-icon {
    font-size: 17px
  }

  .form-grid {
    grid-template-columns: 1fr
  }
}

@media (max-width:380px) {
  body {
    padding: 0
  }

  .app-frame {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    padding: 0
  }

  .screen {
    border-radius: 0;
    min-height: 100vh;
    min-height: 100dvh
  }

  .status {
    height: 0
  }
}
/* ===== Personal Info (profile view) ===== */
.profile-view {
  padding: 4px 20px 8px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px
}

.profile-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px
}

.profile-item.full {
  margin: 10px 20px 0;
  grid-column: 1 / -1
}

.profile-item span {
  font-size: 10.5px;
  color: var(--ink-soft)
}

.profile-item b {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word
}

@media (max-width:600px) {
  .profile-grid {
    grid-template-columns: 1fr
  }
}

/* ===== Admin backend ===== */
.admin-view {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto
}

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

.admin-logout-btn {
  padding: 9px 16px;
  font-size: 12px;
  width: auto;
  white-space: nowrap
}

.admin-section {
  margin: 0 20px 16px
}

.admin-nav {
  display: flex;
  gap: 6px;
  margin: 14px 20px 4px;
  background: var(--sage-bg);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--line)
}

.admin-nav-tab {
  flex: 1;
  text-align: center;
  padding: 9px 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease
}

.admin-nav-tab.active {
  background: linear-gradient(135deg, var(--forest), #3E8A6C);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(31, 95, 74, .55)
}

.admin-nav-tab:not(.active):hover {
  background: #fff
}

.admin-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 12px;
  width: auto;
  white-space: nowrap;
  text-decoration: none
}

.admin-search {
  display: flex;
  gap: 8px
}

.admin-search input[type="text"] {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease
}

.admin-search input[type="text"]:focus {
  border-color: #8ABAA2;
  box-shadow: 0 0 0 3px #E4F1E9
}

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

.user-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 8px 20px -14px rgba(31, 95, 74, .3);
  transition: box-shadow .15s ease, transform .15s ease
}

.user-card:hover {
  box-shadow: 0 10px 24px -12px rgba(31, 95, 74, .4);
  transform: translateY(-1px)
}

.user-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px
}

.user-card-name {
  font-family: 'Prompt', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--forest-dark)
}

.user-card-email {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px
}

.user-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-soft)
}

.user-card-meta b {
  color: var(--ink);
  font-weight: 600
}

.user-card-arrow {
  color: var(--forest);
  font-size: 16px;
  flex-shrink: 0
}

.admin-filter {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 20px -14px rgba(31, 95, 74, .3)
}

.filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: var(--sage-bg);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--line)
}

.filter-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 9px 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease
}

.filter-tab-icon {
  font-size: 13px;
  line-height: 1
}

.filter-tab.active {
  background: linear-gradient(135deg, var(--forest), #3E8A6C);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(31, 95, 74, .55)
}

.filter-tab:not(.active):hover {
  background: #fff
}

.date-field {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.date-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft)
}

.date-field-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 10px
}

.date-range-arrow {
  padding-bottom: 12px;
  color: var(--forest);
  font-size: 14px;
  font-weight: 700
}

.date-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0 4px 0 12px;
  transition: border-color .15s ease, box-shadow .15s ease
}

.date-input-wrap:before {
  content: "";
  font-size: 14px;
  margin-right: 8px;
  flex-shrink: 0
}

.date-input-wrap:focus-within {
  border-color: #8ABAA2;
  box-shadow: 0 0 0 3px #E4F1E9
}

.date-input-wrap input[type="date"] {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 11px 8px 11px 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  font-family: 'Sarabun', 'Noto Sans Thai', Tahoma, sans-serif;
  color-scheme: light
}

.date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  filter: invert(28%) sepia(23%) saturate(1200%) hue-rotate(122deg) brightness(94%) contrast(92%);
  opacity: .85
}

.date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: var(--sage-bg);
  opacity: 1
}

.admin-filter-submit {
  margin-top: 14px;
  width: 100%
}

@media (max-width:480px) {
  .date-field-grid {
    grid-template-columns: 1fr;
    gap: 8px
  }

  .date-range-arrow {
    display: none
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 8px 20px -14px rgba(31, 95, 74, .3)
}

.stat-num {
  font-family: 'Prompt', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--forest-dark)
}

.stat-lab {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 20px -14px rgba(31, 95, 74, .3)
}

.chart-card h4 {
  margin: 0 0 12px;
  font-family: 'Prompt', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--forest-dark)
}

.chart-empty {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  padding: 20px 0
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  overflow-x: auto;
  padding-bottom: 4px
}

.trend-col {
  flex: 1 0 32px;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%
}

.trend-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  width: 100%
}

.trend-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  position: relative;
  display: flex;
  justify-content: center
}

.trend-bar-val {
  position: absolute;
  top: -18px;
  font-size: 10px;
  font-weight: 600;
  color: var(--forest-dark)
}

.trend-label {
  font-size: 9.5px;
  color: var(--ink-soft);
  margin-top: 6px;
  white-space: nowrap
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 30px;
  align-items: center;
  gap: 8px
}

.bar-label {
  font-size: 11.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.bar-track {
  background: var(--sage-bg);
  border-radius: 6px;
  height: 12px;
  overflow: hidden
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  min-width: 3px
}

.bar-val {
  font-size: 11px;
  color: var(--ink-soft);
  text-align: right;
  font-weight: 600
}

.admin-table-wrap {
  overflow-x: auto;
  margin: 0 -4px
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 640px
}

.admin-table th,
.admin-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap
}

.admin-table th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 11px;
  background: var(--sage-bg);
  position: sticky;
  top: 0
}

.admin-table td:nth-child(4),
.admin-table td:nth-child(5) {
  white-space: normal;
  min-width: 140px
}

.score-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700
}

@media (max-width:600px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr
  }

  .stat-card:nth-child(3) {
    grid-column: 1 / -1
  }

  .admin-section {
    margin-left: 12px;
    margin-right: 12px
  }
}
