/* ============================================================
 * PT Notebook — White-Base Energetic Fitness Theme
 * Pure white base · Black strong borders · Volt Green accent · Energy Orange fire
 * Streetwear x Performance App aesthetic
 * ============================================================ */

:root {
  /* Surfaces */
  --bg: #f3f3f3;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #ececec;
  --border: #e2e2e2;
  --border-2: #d0d0d0;
  --border-strong: #0a0a0a;

  /* Text */
  --text: #0a0a0a;
  --text-2: #2c2c2c;
  --text-3: #5a5a5a;
  --muted: #8a8a8a;

  /* Brand & Accent */
  --accent: #c8ff00;          /* Volt Green primary */
  --accent-deep: #9bcc00;
  --accent-soft: rgba(200, 255, 0, 0.22);

  --fire: #ff4500;           /* Energy Orange */
  --fire-deep: #d63800;
  --fire-soft: rgba(255, 69, 0, 0.12);

  --magenta: #ff0080;
  --cyber: #00e1ff;

  --danger: #ff1744;
  --danger-soft: rgba(255, 23, 68, 0.12);
  --warning: #ff9100;

  /* Gradients */
  --grad-volt: linear-gradient(135deg, #c8ff00 0%, #deff60 100%);
  --grad-fire: linear-gradient(135deg, #ff4500 0%, #ff0080 100%);
  --grad-sunset: linear-gradient(135deg, #ff4500 0%, #ffb000 100%);
  --grad-block: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);

  /* Geometry — sharp, athletic edges */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows — hard shadow is signature */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.10);
  --shadow-hard: 4px 4px 0 #0a0a0a;
  --shadow-hard-lg: 6px 6px 0 #0a0a0a;

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --header-h: 56px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  /* Subtle dot pattern — adds sport texture */
  background-image: radial-gradient(circle at 1px 1px, rgba(10,10,10,0.05) 1px, transparent 0);
  background-size: 18px 18px;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  letter-spacing: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px;
  color: inherit;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

/* ==================== Header ==================== */
.app-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 16px;
  padding-top: var(--safe-top);
  height: calc(var(--header-h) + var(--safe-top));
  background: var(--surface);
  border-bottom: 3px solid var(--border-strong);
  position: relative;
  z-index: 5;
}

.app-title {
  font-size: 18px;
  font-weight: 900;
  flex: 1;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--text) 0%, var(--fire) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text);
  transition: all 0.15s;
  border: 2px solid transparent;
}

.icon-btn:active {
  background: var(--accent);
  border-color: var(--border-strong);
  transform: translate(2px, 2px);
}

/* ==================== Main scrollable area ==================== */
.app-main {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}

.view {
  padding: 18px 16px 10px;
  animation: fadeUp 0.3s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 4px 4px 0 var(--border-strong), 0 0 0 0 rgba(255,69,0,0.7); }
  50% { box-shadow: 4px 4px 0 var(--border-strong), 0 0 0 14px rgba(255,69,0,0); }
}

@keyframes fireGlow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,69,0,0)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 8px rgba(255,69,0,0.6)); }
}

@keyframes voltFlash {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ==================== Tab Bar ==================== */
.tab-bar {
  flex: none;
  display: flex;
  align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 3px solid var(--border-strong);
  position: relative;
  z-index: 4;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 0;
  position: relative;
  transition: color 0.15s;
}

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

.tab-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 5px;
  background: var(--accent);
  border-bottom: 2px solid var(--border-strong);
}

.tab-btn svg { transition: transform 0.2s ease; }
.tab-btn.active svg {
  transform: translateY(-2px) scale(1.05);
  stroke-width: 2.5;
}

/* ==================== Cards ==================== */
.card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-hard);
  margin-bottom: 14px;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-title {
  font-size: 10px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
  margin-bottom: 10px;
  display: inline-block;
  background: var(--accent);
  padding: 5px 10px;
  border: 2px solid var(--text);
}

.section-title {
  font-size: 10px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
  margin: 22px 0 12px;
  display: inline-block;
  background: var(--text);
  padding: 6px 12px;
  border-radius: 4px;
  border: 2px solid var(--text);
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border-strong);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
  box-shadow: 4px 4px 0 var(--border-strong);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--border-strong);
}

.btn-primary {
  background: var(--text);
  color: var(--accent);
  border-color: var(--text);
  box-shadow: 4px 4px 0 var(--accent);
}

.btn-primary:active {
  background: var(--accent);
  color: var(--text);
  box-shadow: 1px 1px 0 var(--border-strong);
}

.btn-volt {
  background: var(--accent);
  color: var(--text);
  border-color: var(--text);
  box-shadow: 4px 4px 0 var(--border-strong);
}

.btn-volt:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--border-strong);
}

.btn-fire {
  background: var(--grad-fire);
  color: white;
  border-color: var(--text);
  box-shadow: 4px 4px 0 var(--border-strong);
}

.btn-fire:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--border-strong);
}

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

.btn-ghost:active {
  background: var(--surface-2);
  box-shadow: none;
  transform: none;
}

.btn-danger {
  background: white;
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: 4px 4px 0 var(--danger);
}

.btn-danger:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--danger);
}

.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 10px 14px; font-size: 11px; box-shadow: 3px 3px 0 var(--border-strong); }

/* ==================== Today view ==================== */
.greeting {
  margin: 0 0 18px;
  position: relative;
}

.greeting-eyebrow {
  display: inline-block;
  background: var(--text);
  color: white;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.greeting-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-top: 10px;
  line-height: 0.95;
  text-transform: uppercase;
}

.greeting-title .accent {
  color: var(--fire);
  -webkit-text-fill-color: var(--fire);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  width: 100%;
}

.stat {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 6px;
  text-align: center;
  box-shadow: 3px 3px 0 var(--border-strong);
  min-width: 0;
  position: relative;
}

.stat-value {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}

.stat-label {
  font-size: 9px;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat.featured {
  background: var(--accent);
}

.stat.featured .stat-value { color: var(--text); }
.stat.featured .stat-label { color: var(--text); }

.stat.fire {
  background: var(--grad-fire);
}

.stat.fire .stat-value { color: white; }
.stat.fire .stat-label { color: rgba(255,255,255,0.9); }

.streak-flame {
  display: inline-block;
  font-size: 22px;
  margin-right: 2px;
  animation: fireGlow 1.5s ease-in-out infinite;
  vertical-align: middle;
  line-height: 1;
}

.workout-card {
  background: var(--grad-block);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 5px 5px 0 var(--accent);
}

.workout-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: var(--fire);
  border-radius: 50%;
  transform: rotate(45deg);
  opacity: 0.18;
}

.workout-card::after {
  content: 'TRAIN';
  position: absolute;
  bottom: -10px;
  right: 14px;
  font-size: 64px;
  font-weight: 900;
  color: rgba(255,255,255,0.05);
  letter-spacing: 0.08em;
  pointer-events: none;
}

.workout-card .row {
  position: relative;
  z-index: 1;
}

.workout-card .text-xs {
  color: rgba(255,255,255,0.7);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workout-card > div[style*="font-weight:600"] {
  color: white !important;
}

.workout-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--accent);
  color: var(--text);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 2px solid var(--text);
}

.workout-card .badge.done { background: var(--accent); color: var(--text); }
.workout-card .badge.todo {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
}

.workout-card .text-sm {
  color: rgba(255,255,255,0.85);
  font-weight: 700;
}

.workout-card .btn-primary {
  background: var(--accent);
  color: var(--text);
  border-color: var(--text);
  box-shadow: 4px 4px 0 var(--fire);
  position: relative;
  z-index: 1;
}

.workout-card .btn-primary:active {
  background: var(--fire);
  color: white;
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border-strong);
}

.workout-card-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.12);
  position: relative;
  z-index: 1;
}

.mini-stat {
  text-align: center;
  padding: 4px 2px;
  border-radius: 4px;
}

.mini-stat .mini-value {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: white;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.mini-stat .mini-label {
  font-size: 9px;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 900;
  margin-top: 3px;
}

.mini-stat.fire {
  background: var(--fire);
  border-radius: 4px;
}
.mini-stat.fire .mini-value,
.mini-stat.fire .mini-label {
  color: white;
}

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

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--border-strong);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  transition: all 0.1s;
  cursor: pointer;
}

.quick-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--border-strong);
}

.quick-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--text);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  line-height: 1;
}

.empty-state {
  text-align: center;
  padding: 36px 22px 24px;
  color: var(--muted);
  font-weight: 700;
}

.empty-state .icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 4px 4px 0 var(--border-strong);
  color: var(--text);
}

.empty-state .empty-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  line-height: 1.35;
}

.empty-state .empty-title strong {
  color: var(--accent);
  font-style: normal;
}

.empty-state .empty-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 auto 16px;
  max-width: 320px;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.empty-state .btn-primary {
  max-width: 320px;
  margin: 0 auto;
}

/* Library bottom CTA — secondary addition path always visible */
.lib-footer-cta {
  margin-top: 20px;
  padding: 18px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  text-align: center;
  position: relative;
}

.lib-footer-cta::before {
  content: 'OR';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  padding: 0 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.lib-footer-cta .lib-footer-text {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  line-height: 1.35;
}

.lib-footer-cta .lib-footer-text strong {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-style: normal;
}

.lib-footer-cta .btn {
  max-width: 320px;
  margin: 0 auto;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border-strong);
  box-shadow: 3px 3px 0 var(--border-strong);
  font-weight: 800;
}

.lib-footer-cta .btn:active {
  transform: translate(1.5px, 1.5px);
  box-shadow: 1.5px 1.5px 0 var(--border-strong);
  background: var(--fire);
  color: white;
}

/* Custom tag highlight on exercise rows */
.tag.custom {
  background: var(--fire);
  color: #fff;
  border-color: var(--border-strong);
  font-weight: 900;
  letter-spacing: 0.04em;
}

/* Hint block inside sheets */
.hint-block {
  background: var(--accent-soft);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 12px;
  line-height: 1.4;
  box-shadow: 3px 3px 0 var(--border-strong);
}

/* ==================== Calendar ==================== */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.calendar-nav {
  display: flex;
  gap: 6px;
}

.calendar-nav .icon-btn {
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
}

.calendar-nav .icon-btn:active {
  background: var(--accent);
  transform: translate(2px, 2px);
  box-shadow: none;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  box-shadow: 5px 5px 0 var(--border-strong);
}

.calendar-dow {
  text-align: center;
  font-size: 10px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 900;
  padding: 4px 0 8px;
}

.calendar-day {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  border-radius: 6px;
  color: var(--text);
  transition: all 0.15s;
  cursor: pointer;
  background: var(--surface-2);
  border: 2px solid transparent;
}

.calendar-day.empty {
  visibility: hidden;
  cursor: default;
}

.calendar-day.today {
  background: var(--accent);
  color: var(--text);
  font-weight: 900;
  border-color: var(--text);
  box-shadow: 2px 2px 0 var(--fire);
}

.calendar-day.selected {
  background: var(--text);
  color: white;
  font-weight: 900;
  border-color: var(--text);
}

.calendar-day.has-workout::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fire);
  border: 1.5px solid var(--text);
}

.calendar-day.has-workout.selected::after {
  background: var(--accent);
  border-color: white;
}

.calendar-day:active {
  transform: scale(0.94);
}

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 10px;
  color: var(--text);
  margin-top: 14px;
  padding: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 3px 3px 0 var(--border-strong);
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fire);
  margin-right: 6px;
  vertical-align: middle;
  border: 2px solid var(--text);
}

.legend-dot.outline {
  background: var(--accent);
  border: 2px solid var(--text);
}

.day-detail { margin-top: 14px; }

/* ==================== Library / Lists ==================== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 4px 4px 0 var(--border-strong);
}

.search-bar svg { color: var(--text); }

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.search-bar input::placeholder {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  font-weight: 700;
}

.search-bar .search-add-btn {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--border-strong);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}

.search-bar .search-add-btn svg {
  color: var(--text);
}

.search-bar .search-add-btn:active {
  transform: translate(1.5px, 1.5px);
  box-shadow: 0.5px 0.5px 0 var(--border-strong);
  background: var(--fire);
  color: white;
}

.search-bar .search-add-btn:active svg {
  color: white;
}

.chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin: 0 -16px 14px;
  padding-left: 16px;
  padding-right: 16px;
}

.chips-row::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 8px 16px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 2px solid var(--border-strong);
  transition: all 0.15s;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--border-strong);
}

.chip.active {
  background: var(--text);
  color: var(--accent);
  border-color: var(--text);
}

.chip:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--border-strong);
}

.exercise-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  box-shadow: 4px 4px 0 var(--border-strong);
  cursor: pointer;
  transition: all 0.15s;
}

.exercise-row:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border-strong);
}

.exercise-icon {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  flex: none;
  border: 2px solid var(--text);
  letter-spacing: -0.02em;
}

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

.exercise-meta .name {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.exercise-meta .tags {
  display: flex;
  gap: 4px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.tag {
  font-size: 9px;
  color: var(--text);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--surface-2);
  padding: 3px 7px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
}

.tag.muscle {
  background: var(--text);
  color: var(--accent);
  border-color: var(--text);
}

.tag.equipment {
  background: var(--surface-2);
  color: var(--text);
}

/* ==================== Workout session ==================== */
.workout-summary {
  background: var(--accent);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 5px 5px 0 var(--border-strong);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.workout-summary::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  background: var(--fire);
}

.workout-summary .date {
  font-size: 11px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
}

.workout-summary .summary-line {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text);
  flex-wrap: wrap;
  font-weight: 800;
}

.workout-summary .summary-line .key {
  color: var(--text-3);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  margin-right: 4px;
}

.exercise-session {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: 4px 4px 0 var(--border-strong);
  overflow: hidden;
}

.exercise-session .ex-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-strong);
  background: var(--surface-2);
}

.exercise-session .ex-head .ex-name {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.exercise-session .ex-head .muscle-tag {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 3px;
  background: var(--text);
  color: var(--accent);
  border: 2px solid var(--text);
}

.set-table {
  width: 100%;
  border-collapse: collapse;
}

.set-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text);
  font-weight: 900;
  padding: 10px 6px;
  text-align: left;
  background: var(--surface);
}

.set-table td {
  padding: 8px 6px;
  font-size: 14px;
  border-top: 1px solid var(--border);
}

.set-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  font-weight: 900;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
  border: 2px solid var(--border-strong);
}

.set-num.done {
  background: var(--accent);
  color: var(--text);
  border-color: var(--text);
}

.set-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  outline: none;
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  letter-spacing: -0.01em;
  box-shadow: 2px 2px 0 var(--border);
}

.set-input::-webkit-outer-spin-button,
.set-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.set-input::placeholder {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.set-input:focus {
  background: var(--accent-soft);
  border-color: var(--text);
  box-shadow: 3px 3px 0 var(--text);
}

/* Column header labels — emphasize "reps" & "weight" */
.set-table th .col-unit {
  display: block;
  font-size: 9px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.set-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.icon-mini {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s;
  border: 2px solid var(--border);
  background: var(--surface);
}

.icon-mini:active {
  background: var(--accent);
  border-color: var(--text);
}

.icon-mini.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.icon-mini.danger:active {
  background: var(--danger-soft);
}

.add-set-row {
  padding: 12px 16px;
  text-align: center;
  border-top: 2px dashed var(--border-strong);
  font-size: 12px;
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s;
}

.add-set-row:active { background: var(--accent); }

/* ==================== Day Detail (Calendar > date) ==================== */
.day-cta-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}

.day-cta-row .btn-primary {
  flex: 1;
}

.day-quick-check {
  flex: none;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
}

.day-exercises {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.day-ex-card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 4px 4px 0 var(--border-strong);
  position: relative;
}

.day-ex-card.is-complete {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--accent);
}

.day-ex-card.is-complete::after {
  content: '✓ COMPLETE';
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--accent);
  color: var(--text);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-radius: 4px;
  border: 2px solid var(--text);
}

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

.day-ex-meta {
  flex: 1;
  min-width: 0;
}

.day-ex-name {
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.day-ex-name .tag.inline {
  font-size: 8.5px;
  margin-left: 4px;
  padding: 2px 5px;
}

.day-ex-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.day-ex-sub .muscle-tag.small {
  background: var(--text);
  color: var(--accent);
  padding: 2px 6px;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.day-set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.day-set-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-2);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  position: relative;
}

.day-set-pill.done {
  background: var(--accent);
  border-color: var(--text);
  color: var(--text);
}

.day-set-pill .set-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--text);
  color: var(--accent);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 900;
  flex: none;
}

.day-set-pill.done .set-badge {
  background: var(--text);
  color: var(--accent);
}

.day-set-pill .set-reps,
.day-set-pill .set-weight {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}

.day-set-pill .set-unit {
  font-size: 8.5px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-set-pill.done .set-unit { color: var(--text-2); }

.day-set-pill .set-x {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
}

.day-set-pill .day-set-check {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: var(--text);
  color: var(--accent);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  border: 1.5px solid var(--surface);
}

.day-set-empty {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  font-style: italic;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1.5px dashed var(--border-2);
  margin-top: 4px;
}

.add-exercise-bar {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* ==================== Trainer ==================== */
.trainer-card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 5px 5px 0 var(--border-strong);
}

.trainer-card .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.trainer-card .trainer-name {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trainer-card .trainer-name::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--fire);
  border: 2px solid var(--text);
  transform: rotate(45deg);
}

.trainer-card .date {
  font-size: 10px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.trainer-card .quote {
  background: var(--accent);
  color: var(--text);
  padding: 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  border: 2px solid var(--text);
  position: relative;
}

.trainer-card .quote::before {
  content: '"';
  position: absolute;
  top: -16px;
  left: 8px;
  font-size: 48px;
  font-weight: 900;
  font-family: Georgia, serif;
  color: var(--fire);
  line-height: 1;
}

/* ==================== Profile ==================== */
.profile-hero {
  text-align: center;
  padding: 22px 0 16px;
  position: relative;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 4px;
  background: var(--accent);
  border-bottom: 2px solid var(--text);
}

.avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 38px;
  font-weight: 900;
  border: 4px solid var(--text);
  box-shadow: 6px 6px 0 var(--fire);
}

.profile-name {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.profile-meta {
  color: var(--muted);
  font-size: 10px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 2px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s;
  gap: 8px;
}

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

.setting-row:active { background: var(--surface-2); }

.setting-row .label {
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 900;
  font-size: 12px;
}

.setting-row .value {
  color: var(--muted);
  font-weight: 900;
}

.setting-row .right {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 4px;
  border: 2px solid var(--border);
}

.account-badge {
  padding: 11px 12px;
  margin-bottom: 12px;
  background: var(--accent-soft);
  border: 2px solid var(--border-strong);
  font-size: 12px;
  font-weight: 900;
  word-break: break-word;
}

.auth-loading { margin:auto; padding:40px 24px; text-align:center; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.auth-page { max-width:440px; margin:0 auto; padding:42px 24px 30px; min-height:100%; display:flex; flex-direction:column; }
.auth-mark { width:56px; height:56px; display:grid; place-items:center; background:var(--accent); border:3px solid var(--text); box-shadow:5px 5px 0 var(--fire); font-weight:900; font-size:20px; margin-bottom:26px; }
.auth-kicker { font-size:10px; font-weight:900; letter-spacing:.18em; color:var(--fire); }
.auth-title { margin:8px 0 12px; font-size:34px; line-height:.95; }
.auth-title span { color:var(--fire); }
.auth-copy { margin:0 0 22px; color:var(--text-3); font-size:14px; }
.auth-tabs { display:flex; border-bottom:2px solid var(--text); margin-bottom:20px; }
.auth-tab { flex:1; padding:11px 6px; font-size:11px; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }
.auth-tab.active { background:var(--text); color:var(--accent); }
.auth-form label { display:flex; flex-direction:column; gap:6px; margin-bottom:14px; font-size:10px; font-weight:900; letter-spacing:.14em; text-transform:uppercase; }
.auth-status { min-height:22px; margin:8px 0; color:var(--danger); font-size:12px; font-weight:700; }
.auth-reset { display:block; margin:-4px 0 8px auto; padding:4px 0; color:var(--fire); font-size:12px; font-weight:800; text-decoration:underline; }
.completed-summary { margin:12px 0; border:2px solid var(--border-strong); border-radius:14px; background:var(--accent); box-shadow:4px 4px 0 var(--border-strong); overflow:hidden; }
.completed-summary summary { cursor:pointer; padding:13px 14px; font-weight:900; display:flex; justify-content:space-between; gap:10px; list-style:none; }
.completed-summary summary span { font-size:11px; text-decoration:underline; }
.completed-summary-body { background:#fff; border-top:2px solid var(--border-strong); padding:8px 14px; }
.completed-summary-body div { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--border); font-size:13px; }
.completed-summary-body div:last-child { border-bottom:0; }
.auth-footnote { margin-top:auto; padding-top:24px; color:var(--muted); font-size:11px; text-align:center; }

/* ==================== Form controls ==================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 10px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
}

.input, .textarea, .select {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  outline: none;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--border-strong);
}

.input:focus, .textarea:focus, .select:focus {
  background: var(--accent-soft);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--border-strong);
}

.textarea { resize: none; min-height: 90px; }

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'><path d='M6 9l6 6 6-6' stroke='%230a0a0a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ==================== Bottom Sheet ==================== */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 50;
}

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

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 4px solid var(--border-strong);
  border-radius: 14px 14px 0 0;
  max-height: 86vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 51;
  padding-bottom: calc(var(--safe-bottom) + 16px);
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
}

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

.sheet-handle {
  width: 48px;
  height: 5px;
  background: var(--text);
  border-radius: 3px;
  margin: 12px auto 8px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 14px;
  border-bottom: 3px solid var(--border-strong);
  background: var(--accent);
}

.sheet-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sheet-body { padding: 18px 20px; }

/* ==================== FAB ==================== */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--text);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 4px 0 var(--border-strong);
  z-index: 10;
  font-size: 24px;
  font-weight: 900;
  border: 3px solid var(--accent);
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  background: var(--text);
  color: var(--accent);
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 80%;
  text-align: center;
  line-height: 1.4;
  border: 3px solid var(--accent);
  box-shadow: 6px 6px 0 var(--fire);
}

.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ==================== Detail row (single workout) ==================== */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
}

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

.detail-row .left {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 900;
}

.detail-row .right {
  color: var(--text);
  font-weight: 900;
}

/* ==================== Utilities ==================== */
.row { display: flex; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.fw-600 { font-weight: 600; }

.spacer { height: 16px; }

.scroll-hide::-webkit-scrollbar { display: none; }
.scroll-hide { scrollbar-width: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
 * Coach Capture (OCR) + AI Report styles
 * ============================================================ */

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  border: 3px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 14px;
  box-shadow: 4px 4px 0 var(--border-strong);
}

/* Two source buttons: camera vs photo library */
.capture-source-row {
  display: flex;
  gap: 10px;
}

.capture-source {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  border: 2.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 13px;
  box-shadow: 4px 4px 0 var(--border-strong);
  transition: transform 0.05s, box-shadow 0.05s;
}

.capture-source:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border-strong);
}

/* Auto-register preview items */
.parse-item {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 3px 3px 0 var(--border-strong);
}

.parse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.parse-remove {
  border: none;
  background: transparent;
  color: var(--danger, #ff4500);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  padding: 2px 6px;
}

.parse-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.parse-detail {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted, #666);
  margin-top: 2px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1.5px solid var(--border-strong);
}

.badge.ok {
  background: var(--accent);
  color: var(--text);
}

.badge.new {
  background: var(--fire, #ff4500);
  color: #fff;
}

.sql-block {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.05);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.upload-zone:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border-strong);
}

.capture-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-strong);
  box-shadow: 4px 4px 0 var(--border-strong);
}

.ocr-status {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: 3px 3px 0 var(--border-strong);
}

.status-line {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.status-bar {
  margin-top: 8px;
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
}

.status-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 600;
}

.capture-card {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 4px 4px 0 var(--border-strong);
}

.capture-thumb {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-strong);
  object-fit: cover;
  background: var(--accent-soft);
  display: block;
}

.capture-thumb-empty {
  background:
    repeating-linear-gradient(
      45deg,
      var(--accent-soft),
      var(--accent-soft) 8px,
      var(--accent) 8px,
      var(--accent) 12px
    );
}

.capture-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.capture-date {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}

.capture-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 70px;
  overflow: hidden;
}

/* AI Report */
.report-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 3px 3px 0 var(--border-strong);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.card-warning {
  background: var(--accent-soft);
  border-color: var(--fire);
}

.ai-report-card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 5px 5px 0 var(--border-strong);
}

.ai-report-card .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 8px;
}

.ai-report-period {
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.ai-report-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.ai-report-card details {
  margin-top: 6px;
}

.ai-report-card summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--fire);
  padding: 8px 0;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.ai-report-card summary::before {
  content: '▶';
  font-size: 9px;
  transition: transform 0.2s;
  display: inline-block;
  color: var(--fire);
}

.ai-report-card details[open] > summary::before {
  transform: rotate(90deg);
}

.ai-report-card summary::-webkit-details-marker {
  display: none;
}

.ai-report-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  border: 1.5px solid var(--border);
  white-space: normal;
}

.ai-report-body h2 {
  font-size: 18px;
  font-weight: 900;
  margin: 12px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}

.ai-report-body h3 {
  font-size: 14px;
  font-weight: 900;
  margin: 10px 0 4px;
  color: var(--fire);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-report-body h4 {
  font-size: 13px;
  font-weight: 800;
  margin: 8px 0 4px;
}

.ai-report-body p {
  margin: 4px 0;
}

.ai-report-body ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.ai-report-body li {
  margin: 2px 0;
}

.ai-report-body code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.ai-report-body strong {
  font-weight: 800;
  color: var(--text);
}

.ai-table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 12px;
  background: white;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  overflow: hidden;
}

.ai-table th {
  background: var(--text);
  color: var(--bg);
  padding: 6px 8px;
  text-align: left;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.ai-table td {
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  font-weight: 600;
}

.ai-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.025);
}

.llm-hints {
  margin: 8px 0 0;
  padding-left: 18px;
}

.llm-hints li {
  font-size: 13px;
  line-height: 1.5;
  margin: 4px 0;
  color: var(--text-2);
}

.llm-hints b {
  color: var(--text);
}

/* ==================== Quick Log Form (Home) ==================== */
.qa-row {
  display: flex;
  gap: 10px;
}

.qa-col {
  flex: 1;
  min-width: 0;
}

.qa-col .input {
  text-align: center;
  font-weight: 800;
}

.qa-col .input::placeholder {
  color: var(--muted);
}

/* ==================== Collapsible Blocks (Home) ==================== */
.collapse-block {
  margin-top: 10px;
}

.collapse-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  user-select: none;
  background: var(--bg-card, #fff);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius, 8px);
  box-shadow: 4px 4px 0 var(--border-strong);
  padding: 13px 16px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 14px;
  color: var(--text, #0a0a0a);
}

.collapse-block summary::-webkit-details-marker {
  display: none;
}

.collapse-block summary .chev {
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.collapse-block[open] summary .chev {
  transform: rotate(90deg);
}

.quick-btn.active {
  background: var(--accent);
}

/* ==================== Sleep Tile Value ==================== */
.tile-value {
  font-size: 15px;
  font-weight: 900;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tile-value.has-val {
  color: var(--fire);
}

/* ==================== Photo Crop Stage ==================== */
.crop-wrap {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.crop-wrap img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px dashed var(--fire);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  cursor: move;
  touch-action: none;
}

.crop-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  background: var(--fire);
  border: 2px solid #fff;
  border-radius: 4px;
  box-sizing: border-box;
}

.crop-handle[data-h="nw"] { left: -11px; top: -11px; cursor: nwse-resize; }
.crop-handle[data-h="ne"] { right: -11px; top: -11px; cursor: nesw-resize; }
.crop-handle[data-h="sw"] { left: -11px; bottom: -11px; cursor: nesw-resize; }
.crop-handle[data-h="se"] { right: -11px; bottom: -11px; cursor: nwse-resize; }

/* quick-log set rows */
.set-line .set-del { flex: 0 0 auto; }
.set-line .field { margin: 0; }

/* set badge: number = set order, with tiny "set" caption */
.day-set-pill .set-badge {
  width: 28px;
  height: 24px;
  flex-direction: column;
  gap: 1px;
  border-radius: 4px;
  line-height: 1;
}
.day-set-pill .set-badge-cap {
  display: block;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Language and exercise-effect cards */
.language-switch { display:flex; gap:6px; margin:0 0 14px; }
.lang-choice { flex:1; border:1px solid var(--border-2); background:#fff; border-radius:999px; padding:7px 4px; font:700 11px/1 inherit; color:var(--text-3); }
.lang-choice.active { background:var(--text); color:#fff; border-color:var(--text); }
.language-picker { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.lang-picker-btn { min-height:48px; padding:8px 4px; font-size:13px; }
.exercise-insight { margin:10px 0 2px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface-2); overflow:hidden; }
.exercise-insight summary { cursor:pointer; list-style:none; padding:9px 11px; font-size:12px; font-weight:850; color:var(--text-2); display:flex; align-items:center; justify-content:space-between; }
.exercise-insight summary::-webkit-details-marker { display:none; }
.exercise-insight summary::after { content:'+'; font-size:17px; color:var(--fire); }
.exercise-insight[open] summary::after { content:'−'; }
.insight-grid { border-top:1px solid var(--border); padding:10px 11px 11px; display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.insight-grid div { min-width:0; }
.insight-grid b { display:block; font-size:10px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:3px; }
.insight-grid span { display:block; font-size:12px; line-height:1.35; color:var(--text-2); font-weight:650; }
.insight-grid .insight-benefit { grid-column:1/-1; padding-top:8px; border-top:1px dashed var(--border-2); }
.exercise-detail-insight .exercise-insight { margin:0; }
