/* ORAN Fit Demo — phone layout, dark by default, light optional (spec section 6).
   Fake data only, state in memory, no network (ADR 0006). */

* {
  box-sizing: border-box;
}

:root {
  --violet: #9b5cff;
  --violet-soft: rgba(155, 92, 255, 0.16);
  --glow: 0 14px 34px rgba(155, 92, 255, 0.22);
  --r-card: 16px;
  --r-sheet: 24px;
}

[data-mode='dark'] {
  --text: #f7f5ff;
  --muted: #a7a1b8;
  --bg: #0d0b12;
  --card: #1a1725;
  --card-2: #242032;
  --line: rgba(247, 245, 255, 0.09);
  --primary: #9b5cff;
  --on-primary: #17121f;
  --success: #41c58a;
  --warning: #f4b65a;
  --danger: #f17b91;
  --protein: #5aa8e3;
  --carbs: #f4b65a;
  --fat: #c885ff;
}

[data-mode='light'] {
  --text: #17141f;
  --muted: #6f6a80;
  --bg: #faf9fc;
  --card: #ffffff;
  --card-2: #f1eef8;
  --line: rgba(23, 20, 31, 0.1);
  --primary: #7c3aed;
  --on-primary: #ffffff;
  --success: #1d8f60;
  --warning: #b07a1e;
  --danger: #be2e4a;
  --protein: #2d7cc0;
  --carbs: #b07a1e;
  --fat: #8e46c9;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Tahoma,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 30% at 110% -5%, var(--violet-soft), transparent 70%),
    radial-gradient(50% 28% at -10% 105%, var(--violet-soft), transparent 70%), var(--bg);
}

/* ===== Top bar ===== */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.topbar-titles {
  flex: 1;
  min-width: 0;
}

.topbar-eyebrow {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--violet);
}

.topbar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  flex: none;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== Date navigator ===== */

.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
}

.date-nav__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.date-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.date-nav__btn[disabled] {
  opacity: 0.35;
  cursor: default;
}

/* ===== Screen ===== */

.screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 14px calc(96px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

/* ===== Bottom navigation ===== */

.bottom-nav {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(26, 23, 37, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5;
}

[data-mode='light'] .bottom-nav {
  background: rgba(255, 255, 255, 0.86);
}

.bottom-nav__btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 56px;
  min-height: 52px;
  padding: 8px 4px 4px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.64rem;
  cursor: pointer;
}

.bottom-nav__btn svg {
  width: 21px;
  height: 21px;
}

.bottom-nav__btn.active {
  color: var(--text);
}

.bottom-nav__btn.active::before {
  content: '';
  position: absolute;
  top: -6px;
  width: 30px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}

.nav-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
}

/* ===== Cards and generic bits ===== */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px;
  margin-bottom: 12px;
}

.card__title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 800;
}

.card__hint {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.eyebrow {
  margin: 2px 0 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.btn--primary {
  border: 0;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--glow);
}

.btn--danger {
  border: 0;
  background: var(--danger);
  color: #fff;
}

.btn--ghost {
  background: none;
}

.btn--block {
  width: 100%;
}

.btn--small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.78rem;
}

.row {
  display: flex;
  gap: 8px;
}

.row--wrap {
  flex-wrap: wrap;
}

.row--center {
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  border: 0;
  cursor: default;
}

button.pill {
  cursor: pointer;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge--now {
  background: rgba(241, 123, 145, 0.18);
  color: var(--danger);
}

.badge--important {
  background: rgba(244, 182, 90, 0.16);
  color: var(--warning);
}

.badge--idea {
  background: rgba(155, 92, 255, 0.16);
  color: var(--primary);
}

.badge--info {
  background: rgba(90, 168, 227, 0.16);
  color: var(--protein);
}

.badge--ok {
  background: rgba(65, 197, 138, 0.16);
  color: var(--success);
}

.badge--food {
  background: var(--violet-soft);
  color: var(--primary);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.seg {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.seg__btn {
  flex: 1 1 40%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.seg__btn.active {
  border-color: var(--primary);
  background: var(--violet-soft);
  box-shadow: var(--glow);
}

.empty {
  text-align: center;
  padding: 22px 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.empty__emoji {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 8px;
}

/* ===== Meals: wheel ===== */

.bonus-pill-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wheel {
  position: relative;
  width: 208px;
  height: 208px;
}

.wheel svg {
  transform: rotate(-90deg);
}

.wheel__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
}

.wheel__kcal {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

.wheel__word {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}

.wheel__ratio {
  font-size: 0.72rem;
  color: var(--muted);
}

.macro {
  margin-bottom: 10px;
}

.macro:last-child {
  margin-bottom: 0;
}

.macro__head {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.macro__bar {
  height: 8px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
}

.macro__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s;
}

.macro--protein .macro__fill {
  background: var(--protein);
}

.macro--carbs .macro__fill {
  background: var(--carbs);
}

.macro--fat .macro__fill {
  background: var(--fat);
}

/* ===== Meals: water ===== */

.water__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.water__total {
  font-size: 1.15rem;
  font-weight: 800;
}

.water__btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.water__entry {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px dashed var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ===== Meals: list ===== */

.meal-group__title {
  margin: 14px 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}

.meal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 6px;
  text-align: start;
}

.meal-item__kcal {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.fab-add {
  position: absolute;
  bottom: calc(84px + env(safe-area-inset-bottom));
  inset-inline-end: 16px;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #f17bd6);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--glow);
  z-index: 4;
}

/* ===== Progress ===== */

.stat-row {
  display: flex;
  gap: 10px;
}

.stat {
  flex: 1;
  text-align: center;
  background: var(--card-2);
  border-radius: 12px;
  padding: 10px 6px;
}

.stat__value {
  font-size: 1rem;
  font-weight: 800;
}

.stat__label {
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 2px;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
}

.habit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  font-size: 0.82rem;
}

.habit:first-of-type {
  border-top: 0;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--primary);
  min-height: 44px;
}

.record-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  font-size: 0.82rem;
}

.record-item:first-child {
  border-top: 0;
}

/* ===== Workout ===== */

.week-strip {
  display: flex;
  gap: 6px;
}

.week-day {
  flex: 1;
  text-align: center;
  padding: 8px 2px;
  border-radius: 12px;
  background: var(--card-2);
  font-size: 0.66rem;
  font-weight: 700;
}

.week-day.today {
  border: 1px solid var(--primary);
}

.week-day__state {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
}

.program {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  margin-bottom: 8px;
}

.program__name {
  font-weight: 800;
  font-size: 0.88rem;
}

.program__meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.past-workout {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  font-size: 0.82rem;
}

.past-workout:first-child {
  border-top: 0;
}

.exercise {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  padding: 12px;
  margin-bottom: 10px;
}

.exercise__name {
  font-weight: 800;
  font-size: 0.9rem;
  margin: 0 0 6px;
}

.exercise__record {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.set-row {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 0;
}

.set-row__num {
  width: 20px;
  font-weight: 800;
  color: var(--text);
}

.set-inputs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.set-inputs label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 700;
}

.set-inputs input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 6px 10px;
}

.rest-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--violet-soft);
  margin-bottom: 10px;
}

.rest-timer__count {
  font-size: 1.15rem;
  font-weight: 800;
}

.summary-emoji {
  font-size: 2rem;
  text-align: center;
  display: block;
}

.record-card {
  border: 1px solid var(--warning);
  background: rgba(244, 182, 90, 0.12);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  font-weight: 800;
  text-align: center;
}

/* ===== Coach ===== */

.rec-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  padding: 12px;
  margin-bottom: 10px;
}

.rec-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.rec-card__text {
  margin: 8px 0;
  font-size: 0.88rem;
  font-weight: 700;
}

.rec-card__why {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card-2);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ===== Ask chat ===== */

.chat-notice {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  margin: 0 0 10px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.7;
}

.chat-msg--me {
  align-self: flex-start;
  background: var(--primary);
  color: var(--on-primary);
  border-start-end-radius: 4px;
}

.chat-msg--app {
  align-self: flex-end;
  background: var(--card-2);
  border-start-start-radius: 4px;
}

.chat-msg--typing {
  color: var(--muted);
  font-style: italic;
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text);
  font-family: inherit;
  padding: 8px 14px;
  font-size: 0.9rem;
}

/* ===== Overlay, sheets and modal ===== */

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 14, 0.55);
  backdrop-filter: blur(2px);
  z-index: 20;
  display: flex;
  align-items: flex-end;
}

.overlay[hidden] {
  display: none;
}

.modal-center {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sheet {
  width: 100%;
  max-height: 86%;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}

.modal {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px 16px;
  box-shadow: var(--glow);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sheet__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.sheet__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

.modal__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.modal__text {
  margin: 0 0 14px;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.9;
  text-align: center;
}

.modal__logo {
  display: block;
  text-align: center;
  font-size: 2rem;
  margin-bottom: 8px;
}

.modal__btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-row button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  flex: none;
}

.qty-row input {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  text-align: center;
}

.food-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 6px;
  text-align: start;
}

.food-item__kcal {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.search-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-family: inherit;
  padding: 8px 14px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

/* ===== Onboarding ===== */

.onboard-progress {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin: 6px 0 14px;
}

.onboard-progress span {
  width: 22px;
  height: 5px;
  border-radius: 999px;
  background: var(--card-2);
}

.onboard-progress span.done {
  background: var(--primary);
}

.onboard-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.goal-hint {
  text-align: center;
  font-size: 0.74rem;
  color: var(--muted);
  margin: -6px 0 12px;
}

.review-kcal {
  text-align: center;
  margin-bottom: 14px;
}

.review-kcal__value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--primary);
}

.review-kcal__label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

/* ===== Toasts ===== */

.toasts {
  position: absolute;
  bottom: calc(96px + env(safe-area-inset-bottom));
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 30;
  pointer-events: none;
}

.toast {
  max-width: 86%;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--glow);
  font-size: 0.8rem;
  font-weight: 700;
}
