:root {
  color-scheme: light;
  --ink: #171611;
  --ink-soft: #575247;
  --paper: #f6f2e8;
  --paper-strong: #fffdf7;
  --line: rgba(37, 31, 19, 0.11);
  --gold: #c7942f;
  --gold-strong: #9c6b13;
  --gold-soft: #f4e2b6;
  --charcoal: #171713;
  --green: #1f7a52;
  --red: #b13d34;
  --blue: #386d94;
  --shadow: 0 16px 42px rgba(50, 38, 14, 0.1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -10%, rgba(213, 166, 73, 0.22), transparent 38%),
    linear-gradient(180deg, #fbf8f0 0%, var(--paper) 60%);
}
button, input, textarea { font: inherit; }
button { color: inherit; }

.app-loading {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: #11100d;
  color: #f6e7bd;
}
.boot-mark {
  font: 800 54px/1 Arial Black, sans-serif;
  letter-spacing: -5px;
  color: #e4b654;
  text-shadow: 0 0 28px rgba(228, 182, 84, 0.28);
}
.boot-line { width: 132px; height: 2px; background: #373124; overflow: hidden; }
.boot-line span { display: block; width: 50%; height: 100%; background: #e4b654; animation: boot 1.1s ease-in-out infinite alternate; }
.app-loading p { margin: 0; font-size: 13px; color: #a79b82; }
@keyframes boot { from { transform: translateX(-80%); } to { transform: translateX(180%); } }

.shell { width: min(100%, 820px); min-height: 100dvh; margin: 0 auto; padding-bottom: 92px; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(250, 247, 238, 0.88);
  border-bottom: 1px solid rgba(49, 40, 21, 0.07);
  backdrop-filter: blur(18px);
}
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-symbol {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--charcoal);
  color: #e7bb5d;
  font: 900 13px/1 Arial Black, sans-serif;
  letter-spacing: -1.5px;
  box-shadow: 0 7px 18px rgba(25, 23, 17, 0.18);
}
.brand-copy strong { display: block; font-size: 15px; letter-spacing: -0.2px; }
.brand-copy span { display: block; margin-top: 1px; color: var(--ink-soft); font-size: 11px; }
.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(154, 105, 18, 0.22);
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-strong);
  font-weight: 800;
}
.content { padding: 16px 14px 30px; }

.hero {
  position: relative;
  min-height: 212px;
  overflow: hidden;
  padding: 24px 22px;
  border-radius: 28px;
  background: #181713;
  color: #fff8e5;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0 0 0 38%;
  background: linear-gradient(90deg, #181713 0%, rgba(24, 23, 19, 0.52) 35%, rgba(24, 23, 19, 0.04) 100%), url("/zfit-brand.png") center/cover no-repeat;
  opacity: 0.8;
  mix-blend-mode: screen;
}
.hero > * { position: relative; z-index: 1; }
.hero-kicker { color: #ddbd72; text-transform: uppercase; letter-spacing: 1.5px; font-size: 10px; font-weight: 800; }
.hero h1 { max-width: 70%; margin: 14px 0 10px; font-size: clamp(28px, 8vw, 42px); line-height: 0.98; letter-spacing: -1.6px; }
.hero p { max-width: 68%; margin: 0; color: #c7bdab; font-size: 13px; line-height: 1.45; }
.hero-badge { display: inline-flex; margin-top: 22px; padding: 8px 11px; border: 1px solid rgba(231, 187, 93, 0.32); border-radius: 999px; background: rgba(231, 187, 93, 0.12); color: #f0d698; font-size: 11px; font-weight: 700; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 26px 2px 11px; }
.section-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.45px; }
.section-head span, .section-head button { color: var(--ink-soft); font-size: 12px; }
.section-head button { border: 0; background: none; padding: 5px; }
.grid { display: grid; gap: 10px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: 0 8px 24px rgba(57, 43, 15, 0.045);
}
.card.compact { padding: 14px; }
.card.dark { background: var(--charcoal); border-color: transparent; color: #fff8e7; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; }
.dark .eyebrow { color: #a89d86; }
.value { display: block; font-size: 25px; font-weight: 850; letter-spacing: -1px; }
.value small { margin-left: 3px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.dark .value small { color: #a89d86; }
.subtle { color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.stack.tight { gap: 6px; }
.dossier { padding-block: 4px; }
.fact-item { display: grid; gap: 4px; padding: 15px 0; border-top: 1px solid var(--line); }
.fact-item:first-child { border-top: 0; }
.fact-item .eyebrow { margin-bottom: 1px; }
.fact-item strong { font-size: 14px; line-height: 1.3; }
.fact-value { color: var(--ink-soft); font-size: 13px; line-height: 1.5; white-space: pre-line; }
.fact-value.needs-clarification { color: #91661d; font-style: italic; }
.divider { height: 1px; background: var(--line); margin: 13px 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 999px; background: #eee9dc; color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.pill.gold { background: var(--gold-soft); color: #7b5310; }
.pill.green { background: #dcefe6; color: #17633f; }
.pill.red { background: #f5ded9; color: #91322b; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.appointment-time { min-width: 58px; font-size: 18px; font-weight: 800; letter-spacing: -0.5px; }
.appointment-main { min-width: 0; flex: 1; }
.appointment-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appointment-main span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.action-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.btn {
  min-height: 40px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper-strong);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.primary { border-color: var(--charcoal); background: var(--charcoal); color: #fff8e6; }
.btn.gold { border-color: #d7ab50; background: #e1b75e; color: #342407; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: 0.52; cursor: wait; }
.btn.full { width: 100%; margin-bottom: 10px; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-strong); color: var(--ink); font-size: 22px; cursor: pointer; }
.composer { margin: 10px 0; border-color: #d6b66f; box-shadow: 0 16px 44px rgba(66, 49, 13, 0.1); }
.field { display: grid; gap: 6px; margin-top: 12px; color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px; background: #fffdf8; color: var(--ink); outline: none; line-height: 1.45; }
.field input:focus, .field textarea:focus { border-color: #c8993d; box-shadow: 0 0 0 3px rgba(200, 153, 61, 0.12); }
.field textarea { resize: vertical; }
.form-help { margin: 8px 0 12px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }

.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e7e0d2; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a87217, #e3bc68); }
.macro-grid { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 7px; }
.macro { padding: 13px 10px; border-radius: 16px; background: #eee8db; }
.macro:first-child { background: var(--charcoal); color: white; }
.macro span { display: block; color: var(--ink-soft); font-size: 9px; text-transform: uppercase; }
.macro:first-child span { color: #a99d86; }
.macro strong { display: block; margin-top: 7px; font-size: 17px; }
.chart { display: flex; align-items: end; height: 100px; gap: 7px; padding-top: 14px; }
.chart-col { flex: 1; display: grid; align-content: end; gap: 5px; height: 100%; text-align: center; }
.chart-bar { min-height: 4px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #e2b75c, #a66f13); }
.chart-label { color: var(--ink-soft); font-size: 9px; }

.client-card { cursor: pointer; }
.client-card:active { background: #f7eed7; }
.client-avatar { width: 43px; height: 43px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; background: #eadcb8; color: #79520d; font-weight: 850; }
.client-copy { min-width: 0; flex: 1; }
.client-copy strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-copy span { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 11px; }
.flag { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.flag.alert { background: var(--red); box-shadow: 0 0 0 5px rgba(177, 61, 52, 0.1); }
.search { position: relative; display: block; margin-bottom: 12px; }
.search input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 15px 0 42px;
  background: rgba(255, 253, 247, 0.9);
  color: var(--ink);
  outline: none;
}
.search::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 16px;
  top: 50%;
  width: 11px;
  height: 11px;
  border: 1.7px solid var(--ink-soft);
  border-radius: 50%;
  transform: translateY(-60%);
  pointer-events: none;
}
.search::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 27px;
  top: calc(50% + 5px);
  width: 6px;
  height: 1.7px;
  border-radius: 999px;
  background: var(--ink-soft);
  transform: rotate(45deg);
  transform-origin: left center;
  pointer-events: none;
}

.exercise { padding: 14px 0; border-top: 1px solid var(--line); }
.exercise:first-child { padding-top: 0; border-top: 0; }
.exercise strong { display: block; }
.exercise-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.message { max-width: 88%; padding: 11px 13px; border-radius: 16px 16px 16px 5px; background: #ece5d7; font-size: 12px; line-height: 1.45; }
.message.outbound { margin-left: auto; border-radius: 16px 16px 5px 16px; background: var(--gold-soft); }
.message time { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 9px; }
.review-question { padding: 12px; border-left: 3px solid #d0a34a; border-radius: 0 12px 12px 0; background: #f2ecdf; font-size: 12px; line-height: 1.48; }
.review-draft { width: 100%; min-height: 118px; resize: vertical; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); line-height: 1.45; outline: none; }

.empty { padding: 32px 20px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; margin-bottom: 5px; color: var(--ink); }
.error-box { max-width: 440px; margin: 80px auto; padding: 24px; text-align: center; }
.error-box h1 { margin: 0 0 10px; font-size: 22px; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  width: min(100%, 820px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(50, 43, 28, 0.08);
  background: rgba(252, 249, 241, 0.94);
  backdrop-filter: blur(18px);
}
.nav-btn { display: grid; justify-items: center; gap: 4px; border: 0; background: none; color: #847d6e; font-size: 9px; font-weight: 700; }
.nav-icon { width: 35px; height: 29px; display: grid; place-items: center; border-radius: 12px; font-size: 18px; }
.nav-btn.active { color: var(--ink); }
.nav-btn.active .nav-icon { background: var(--gold-soft); color: #7b5410; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: calc(100% - 30px); padding: 11px 15px; border-radius: 13px; background: #171713; color: white; opacity: 0; pointer-events: none; font-size: 12px; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 620px) {
  .content { padding-inline: 22px; }
  .grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero { min-height: 250px; padding: 34px; }
  .hero h1 { max-width: 55%; }
  .hero p { max-width: 50%; }
}

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