@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap");

:root {
  --ink: #2b2a26;
  --plaster: #ece6d8;
  --plaster-dim: #e2dbc9;
  --fern: #3f5443;
  --fern-dark: #2e3f32;
  --clay: #b5697a;
  --brass: #a9793c;
  --stone: #8c8577;
  --white: #fffdf8;
  --line: rgba(43, 42, 38, 0.1);
  --shadow: 0 10px 30px rgba(43, 42, 38, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #d8d2c0;
  font-family: "Inter", -apple-system, sans-serif;
  color: var(--ink);
}

.backdrop {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ---------- phone frame ---------- */
.phone {
  width: 390px;
  height: 844px;
  background: var(--plaster);
  border-radius: 44px;
  border: 10px solid #1c1b18;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Opaque strip behind the notch so scrolled content can never show through
   or collide with the notch; sits above view content, below the notch itself. */
.status-bar-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  background: var(--plaster);
  z-index: 45;
}

.notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 26px;
  background: #1c1b18;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  z-index: 50;
}

.screen-area {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ---------- views ---------- */
.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 44px 18px 16px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.view.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.view::-webkit-scrollbar {
  display: none;
}

/* ---------- typography ---------- */
h1,
h2,
h3 {
  font-family: "Fraunces", serif;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fern);
  font-weight: 600;
}

.subtitle {
  color: var(--stone);
  font-size: 13.5px;
  margin-top: 4px;
  line-height: 1.4;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

/* ---------- header ---------- */
.screen-header {
  margin-bottom: 18px;
}

.screen-header h1 {
  font-size: 26px;
}

/* ---------- bottom nav ---------- */
.tabbar {
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0) + 8px);
  z-index: 40;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 6px 2px;
  font-family: "Inter", sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--stone);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 150ms ease, transform 100ms ease;
}

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

.tab.active {
  color: var(--fern);
}

.tab:active {
  transform: scale(0.92);
}

/* ---------- tap affordance ---------- */
.tappable {
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.tappable:active,
.tappable.tap-active {
  transform: scale(0.97);
}

button {
  font-family: inherit;
}

/* ---------- cards ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(43, 42, 38, 0.05);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 8px;
}

.section-title h3 {
  font-size: 15px;
}

.section-title .count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--stone);
  background: var(--plaster-dim);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}

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

.btn-primary:active {
  background: #8f652f;
}

.btn-ghost {
  background: var(--white);
  color: var(--fern);
  border: 1px solid var(--line);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  color: var(--fern);
}

/* ---------- HOME ---------- */
.greeting-card {
  background: linear-gradient(135deg, var(--fern) 0%, var(--fern-dark) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 4px;
}

.greeting-card h1 {
  color: var(--white);
  font-size: 22px;
}

.greeting-card p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  margin: 6px 0 0;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.quick-action {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.quick-action .qi {
  font-size: 18px;
}

.quick-action span.label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.schedule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.schedule-row:last-child {
  border-bottom: none;
}

.schedule-time {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--fern);
  width: 62px;
  flex-shrink: 0;
}

.schedule-info {
  flex: 1;
  min-width: 0;
}

.schedule-info .name {
  font-size: 13.5px;
  font-weight: 600;
}

.schedule-info .meta {
  font-size: 11.5px;
  color: var(--stone);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--clay);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 10.5px;
}

.avatar.avatar-group {
  background: var(--plaster-dim);
  color: var(--fern);
}

.avatar-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.avatar-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  width: 56px;
}

.avatar-chip span {
  font-size: 10.5px;
  color: var(--stone);
  font-weight: 600;
  text-align: center;
}

/* ---------- BUILDER ---------- */
.with-client {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--stone);
  margin-top: 6px;
}

.builder-section {
  margin-top: 14px;
}

.builder-section .section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.builder-section .section-label h3 {
  font-size: 14px;
  color: var(--fern);
}

.exercise-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.exercise-card.dragging {
  opacity: 0.4;
}

.exercise-card.drag-over {
  border-color: var(--brass);
  box-shadow: 0 0 0 2px rgba(169, 121, 60, 0.25);
}

.drag-handle {
  font-size: 15px;
  color: var(--stone);
  cursor: grab;
  padding: 0 2px;
  user-select: none;
}

.exercise-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--plaster-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.exercise-card .info {
  flex: 1;
  min-width: 0;
}

.exercise-card .info .name {
  font-size: 13.5px;
  font-weight: 600;
}

.exercise-card .info .detail {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--brass);
  margin-top: 2px;
}

.exercise-card .remove {
  font-size: 16px;
  color: var(--stone);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.add-exercise-btn {
  width: 100%;
  border: 1.5px dashed var(--stone);
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fern);
  cursor: pointer;
}

.empty-section {
  font-size: 12px;
  color: var(--stone);
  padding: 10px 4px;
  font-style: italic;
}

/* ---------- EXERCISE LIBRARY ---------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.search-box input {
  border: none;
  outline: none;
  background: none;
  font-size: 13.5px;
  flex: 1;
  color: var(--ink);
  font-family: "Inter", sans-serif;
}

.filter-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--stone);
  cursor: pointer;
}

.chip.active {
  background: var(--fern);
  color: var(--white);
  border-color: var(--fern);
}

.lib-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.lib-list-item .info {
  flex: 1;
  min-width: 0;
}

.lib-list-item .name {
  font-size: 13.5px;
  font-weight: 600;
}

.lib-list-item .tags {
  font-size: 11px;
  color: var(--stone);
  margin-top: 2px;
}

.lib-list-item .chev {
  color: var(--stone);
  font-size: 16px;
}

/* ---------- EXERCISE DETAIL SHEET ---------- */
.sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(43, 42, 38, 0.4);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

/* exercise detail can be opened from on top of the picker sheet, so it needs to win the stack */
#exercise-sheet-overlay {
  z-index: 62;
}

.sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--plaster);
  border-radius: 22px 22px 0 0;
  max-height: 82%;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1);
  padding: 14px 18px 26px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
}

.sheet-overlay.open .sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--line);
  border-radius: 3px;
  margin: 0 auto 14px;
}

.detail-hero {
  width: 100%;
  height: 130px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--fern) 0%, var(--stone) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 14px;
}

.tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--fern);
  background: var(--plaster-dim);
  padding: 4px 9px;
  border-radius: 20px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.detail-row .k {
  color: var(--stone);
  font-weight: 600;
}

.detail-row .v {
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
}

.detail-block h4 {
  font-family: "Inter", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--stone);
  margin: 16px 0 6px;
}

.detail-block p,
.detail-block li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

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

/* ---------- CLIENTS ---------- */
.client-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
}

.client-list-item .info {
  flex: 1;
  min-width: 0;
}

.client-list-item .name {
  font-size: 13.5px;
  font-weight: 600;
}

.client-list-item .meta {
  font-size: 11.5px;
  color: var(--stone);
  margin-top: 1px;
}

.client-list-item .chev {
  color: var(--stone);
}

.alert-card {
  background: rgba(181, 105, 122, 0.1);
  border: 1px solid rgba(181, 105, 122, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 10px 0;
}

.alert-card h4 {
  margin: 0 0 6px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clay);
  font-family: "Inter", sans-serif;
}

.alert-card ul {
  margin: 0;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.5;
}

.goal-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--fern);
  background: var(--plaster-dim);
  padding: 4px 10px;
  border-radius: 20px;
  margin: 0 6px 6px 0;
}

/* ---------- TEMPLATES ---------- */
.template-card {
  padding: 14px;
  margin-bottom: 10px;
}

.template-card h3 {
  font-size: 15px;
}

.template-card .subtitle {
  margin: 4px 0 10px;
}

.template-meta {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--stone);
  font-family: "IBM Plex Mono", monospace;
  margin-bottom: 12px;
}

/* ---------- misc ---------- */
.back-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.spacer-40 {
  height: 40px;
}

.hint-caption {
  text-align: center;
  font-size: 11px;
  color: var(--stone);
  margin-top: 500px;
}
