:root {
  --surface: #2a2d35;
  --text: #c8cdd8;
  --silver: #a8aeba;
  --dim: #5a6070;
  --faint: #3e4250;
  --glow: #1478ff;
  --glow-rgb: 20,120,255;
  --green: #5a9a75;
  --red: #a05555;
  --pink: #8a5565;
  --r: 14px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --neo: 4px 4px 10px rgba(0,0,0,0.5), -3px -3px 8px rgba(60,65,78,0.12);
  --neo-lg: 6px 6px 14px rgba(0,0,0,0.55), -4px -4px 10px rgba(60,65,78,0.14);
  --neo-in: inset 3px 3px 7px rgba(0,0,0,0.5), inset -3px -3px 7px rgba(60,65,78,0.1);
  --neo-in-sm: inset 2px 2px 4px rgba(0,0,0,0.4), inset -2px -2px 4px rgba(60,65,78,0.08);
  --shine: none;
}

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

body {
  font-family: -apple-system, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  line-height: 1.5;
  position: relative;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body > *:not(.toast):not(.chart-popup):not(.entry-modal-backdrop) { position: relative; z-index: 1; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}


/* ════════════════════════════════════
   AUTH
   ════════════════════════════════════ */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--neo-lg);
  background-image: var(--shine);
}

.auth-logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: #b8917a;
  text-align: center;
  margin-bottom: 2.5rem;
  letter-spacing: -0.05em;
}

.auth-card h2 {
  margin-bottom: 1.8rem;
  color: var(--dim);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.auth-card input {
  width: 100%;
  padding: 0.9rem 1.1rem;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 0.9rem;
  outline: none;
  transition: all 0.4s var(--ease);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--neo-in);
  font-family: inherit;
}
.auth-card input::placeholder { color: var(--faint); }
.auth-card input:focus { box-shadow: var(--neo-in), 0 0 0 2px rgba(var(--glow-rgb),0.3), 0 0 20px rgba(var(--glow-rgb),0.08); }

.auth-switch { margin-top: 2rem; font-size: 0.85rem; color: var(--dim); text-align: center; }
.auth-switch a { color: var(--silver); text-decoration: none; font-weight: 600; transition: all 0.3s var(--ease); }
.auth-switch a:hover { color: var(--glow); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }
.flash { background: var(--surface); color: var(--red); padding: 0.7rem 1rem; border-radius: 10px; margin-bottom: 1.2rem; font-size: 0.85rem; box-shadow: var(--neo-in); }


/* ════════════════════════════════════
   HEADER
   ════════════════════════════════════ */

header {
  background: var(--surface);
  color: var(--text);
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  background-image: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 100%);
  padding-top: env(safe-area-inset-top, 0);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #b8917a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.3s var(--ease);
}
.logo:hover { filter: brightness(1.3); }
.logo-icon { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.auth-logo .logo-icon { width: 48px; height: 48px; border-radius: 10px; }
.header-right { display: flex; align-items: center; gap: 0.8rem; }
.username { font-size: 0.8rem; font-weight: 500; color: var(--dim); letter-spacing: 0.02em; }


/* ════════════════════════════════════
   COMMANDER
   ════════════════════════════════════ */

.cmd-lock-btn { background: none; border: none; font-size: 1rem; cursor: pointer; padding: 0.2rem; line-height: 1; }
.cmd-panel { display: flex; align-items: center; gap: 4px; }

.cmd-input {
  width: 54px;
  padding: 0.3rem 0.4rem;
  border: none;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
  text-align: center;
  box-shadow: var(--neo-in-sm);
  font-family: inherit;
}
.cmd-input::placeholder { color: var(--faint); }

.cmd-go-btn {
  background: var(--surface);
  border: none;
  color: var(--silver);
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  box-shadow: var(--neo);
  transition: all 0.3s var(--ease);
  background-image: var(--shine);
}
.cmd-go-btn:hover { color: var(--glow); box-shadow: var(--neo-lg), 0 0 15px rgba(var(--glow-rgb),0.1); }

.cmd-select {
  padding: 0.3rem 0.4rem;
  border: none;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  outline: none;
  max-width: 120px;
  box-shadow: var(--neo-in-sm);
  font-family: inherit;
}
.cmd-select option { color: var(--text); background: var(--surface); }

.cmd-banner {
  max-width: 900px;
  margin: 1.5rem auto 0;
  padding: 0.8rem 1.5rem;
  background: var(--surface);
  border-radius: var(--r);
  border-left: 3px solid var(--silver);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--silver);
  box-shadow: var(--neo);
  background-image: var(--shine);
}

.cmd-user-actions { display: flex; gap: 0.4rem; }

.cmd-edit-btn {
  background: var(--surface);
  color: var(--text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.28rem 0.65rem;
  font-weight: 700;
  box-shadow: var(--neo);
  transition: all 0.3s var(--ease);
  font-family: inherit;
  background-image: var(--shine);
}
.cmd-edit-btn:hover { color: var(--glow); box-shadow: var(--neo-lg), 0 0 12px rgba(var(--glow-rgb),0.1); }

.cmd-delete-btn {
  background: var(--surface);
  color: var(--red);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.28rem 0.65rem;
  font-weight: 700;
  box-shadow: var(--neo);
  font-family: inherit;
  transition: all 0.3s var(--ease);
  background-image: var(--shine);
}
.cmd-delete-btn:hover { box-shadow: var(--neo-lg); }

.cmd-exit-btn {
  margin-left: auto;
  background: var(--surface);
  border: none;
  color: var(--dim);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.28rem 0.65rem;
  font-weight: 600;
  box-shadow: var(--neo);
  transition: all 0.3s var(--ease);
  font-family: inherit;
  background-image: var(--shine);
}
.cmd-exit-btn:hover { color: var(--glow); box-shadow: var(--neo-lg), 0 0 12px rgba(var(--glow-rgb),0.1); }

.cmd-edit-modal {
  position: fixed;
  inset: 0;
  background: rgba(20,22,28,0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cmd-edit-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--neo-lg);
  background-image: var(--shine);
}
.cmd-edit-card h3 {
  margin-bottom: 1.5rem;
  color: #b8917a;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.cmd-edit-card label {
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  color: var(--dim);
  gap: 0.35rem;
  margin-bottom: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.cmd-edit-card input,
.cmd-edit-card select {
  padding: 0.6rem 0.8rem;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--neo-in);
  font-family: inherit;
}

.cmd-edit-actions { display: flex; gap: 0.8rem; margin-top: 1.5rem; }


/* ════════════════════════════════════
   PHASE BANNER
   ════════════════════════════════════ */

.phase-banner {
  max-width: 900px;
  margin: 1.8rem auto 0;
  padding: 1.4rem 2rem;
  background: var(--surface);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  box-shadow: var(--neo);
  background-image: var(--shine);
}
.phase-banner.cut .phase-label { color: var(--red); }

.phase-info { display: flex; flex-direction: column; gap: 0.25rem; min-width: 140px; }
.phase-label {
  font-weight: 800;
  font-size: 1.1rem;
  color: #b8917a;
  letter-spacing: -0.03em;
}
.phase-detail { font-size: 0.8rem; color: var(--dim); font-weight: 500; }

.phase-progress-wrap { flex: 1; display: flex; align-items: center; gap: 1rem; min-width: 140px; }
.phase-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: var(--neo-in-sm);
}
#phase-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--silver), var(--text));
  border-radius: 99px;
  transition: width 0.6s var(--ease);
}
.phase-banner.cut #phase-progress-fill { background: linear-gradient(90deg, var(--red), #c06060); }
#phase-progress-text { font-size: 0.8rem; font-weight: 700; color: var(--dim); white-space: nowrap; }


/* ════════════════════════════════════
   SETTINGS
   ════════════════════════════════════ */

.settings-panel {
  max-width: 900px;
  margin: 1rem auto 0;
  background: var(--surface);
  border-radius: var(--r);
  padding: 1.6rem 2rem;
  box-shadow: var(--neo);
  background-image: var(--shine);
  display: flex;
  gap: 1.8rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.settings-panel h3 {
  width: 100%;
  margin-bottom: 0;
  font-size: 0.68rem;
  color: var(--dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.settings-panel label {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  color: var(--dim);
  gap: 0.4rem;
  font-weight: 500;
}

.settings-panel select,
.settings-panel input {
  padding: 0.6rem 0.8rem;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: all 0.4s var(--ease);
  box-shadow: var(--neo-in);
  font-family: inherit;
}
.settings-panel select:focus,
.settings-panel input:focus { box-shadow: var(--neo-in), 0 0 0 2px rgba(var(--glow-rgb),0.25), 0 0 15px rgba(var(--glow-rgb),0.06); }


/* ════════════════════════════════════
   PLAN DISPLAY
   ════════════════════════════════════ */

.plan-display {
  max-width: 900px;
  margin: 1rem auto 0;
  padding: 1.4rem 2rem;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--neo);
  background-image: var(--shine);
}
.plan-display h3 {
  font-size: 0.68rem;
  color: var(--dim);
  margin-bottom: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.plan-display pre {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  line-height: 1.7;
}


/* ════════════════════════════════════
   SUMMARY BAR
   ════════════════════════════════════ */

.summary-bar {
  max-width: 900px;
  margin: 1.5rem auto 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  padding: 0 1.5rem;
}

.summary-card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 1.4rem 1.2rem;
  box-shadow: var(--neo);
  border: none;
  background-image: var(--shine);
  position: relative;
  overflow: hidden;
}

.summary-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #b8917a;
  transition: all 0.4s var(--ease);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.summary-lbl {
  font-size: 0.62rem;
  color: var(--dim);
  margin-top: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}


/* ════════════════════════════════════
   PAGE TABS
   ════════════════════════════════════ */

.page-tabs {
  max-width: 900px;
  margin: 1.5rem auto 0;
  display: flex;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--neo);
  padding: 6px;
  gap: 4px;
  background-image: var(--shine);
}

.page-tab {
  flex: 1;
  text-align: center;
  padding: 0.75rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dim);
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: 10px;
  transition: all 0.35s var(--ease);
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.page-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--neo-in);
}
.page-tab:hover:not(.active) { color: var(--glow); text-shadow: 0 0 12px rgba(var(--glow-rgb),0.3); }


/* ════════════════════════════════════
   PAGES
   ════════════════════════════════════ */

.pages-container {
  max-width: 900px;
  margin: 1.5rem auto 0;
}

.page {
  display: none;
  padding: 0 1rem 3rem;
  flex-direction: column;
  gap: 1.8rem;
  box-sizing: border-box;
}
.page.active {
  display: flex;
  animation: pageFadeIn 0.2s ease-out;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ════════════════════════════════════
   CHART CARDS
   ════════════════════════════════════ */

.chart-card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 2rem 1.8rem;
  box-shadow: var(--neo);
  transition: all 0.4s var(--ease);
  background-image: var(--shine);
}

.chart-card h3 {
  font-size: 0.68rem;
  color: var(--dim);
  margin-bottom: 1.5rem;
  font-weight: 700;
  transition: all 0.3s var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hiit-warning {
  background: var(--surface);
  color: var(--dim);
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  box-shadow: var(--neo-in-sm);
}


/* ════════════════════════════════════
   LOG SECTIONS
   ════════════════════════════════════ */

.log-section, .plan-section {
  background: var(--surface);
  border-radius: var(--r);
  padding: 2rem 1.8rem;
  box-shadow: var(--neo);
  background-image: var(--shine);
}

.log-section h2, .plan-section h2 {
  font-size: 0.68rem;
  margin-bottom: 1.8rem;
  color: var(--dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.form-row {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.tab-content label,
.log-section label {
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  color: var(--dim);
  gap: 0.4rem;
  flex: 1;
  min-width: 110px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tab-content input,
.tab-content select,
.tab-content textarea,
.log-section form input,
.log-section form select,
.log-section form textarea {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: all 0.4s var(--ease);
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--neo-in);
  letter-spacing: -0.01em;
  -webkit-appearance: none;
  appearance: none;
}

.tab-content input:focus,
.tab-content select:focus,
.tab-content textarea:focus,
.log-section form input:focus,
.log-section form select:focus,
.log-section form textarea:focus { box-shadow: var(--neo-in), 0 0 0 2px rgba(var(--glow-rgb),0.25), 0 0 18px rgba(var(--glow-rgb),0.06); }

.tab-content textarea,
.log-section form textarea { width: 100%; resize: vertical; }

.supp-checks { gap: 1rem !important; margin-bottom: 0.6rem; }
.supp-check {
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.4rem !important;
  min-width: auto !important;
  flex: 0 !important;
  font-weight: 600;
  font-size: 0.85rem !important;
  cursor: pointer;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.supp-check input[type="checkbox"] {
  width: auto !important;
  padding: 0 !important;
  margin: 0;
  accent-color: var(--glow);
  box-shadow: none !important;
}

.sleep-calc {
  margin: 0.6rem 0;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--dim);
  font-weight: 500;
  box-shadow: var(--neo-in-sm);
}

#weekly-plan {
  width: 100%;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-bottom: 1rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--neo-in);
}
#weekly-plan:focus { box-shadow: var(--neo-in), 0 0 0 2px rgba(var(--glow-rgb),0.25), 0 0 18px rgba(var(--glow-rgb),0.06); }


/* ════════════════════════════════════
   BUTTONS — raised, press in
   ════════════════════════════════════ */

.btn-primary {
  background: var(--surface);
  color: var(--silver);
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.35s var(--ease);
  margin-top: 0.8rem;
  box-shadow: var(--neo);
  letter-spacing: 0.02em;
  font-family: inherit;
  background-image: var(--shine);
}
.btn-primary:hover { color: var(--glow); box-shadow: var(--neo-lg), 0 0 20px rgba(var(--glow-rgb),0.12); transform: translateY(-2px); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }
.btn-primary:active { box-shadow: var(--neo-in); transform: translateY(1px); color: var(--dim); text-shadow: none; }

.btn-outline {
  background: var(--surface);
  color: var(--dim);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.35s var(--ease);
  font-weight: 700;
  box-shadow: var(--neo);
  font-family: inherit;
  background-image: var(--shine);
}
.btn-outline:hover { color: var(--glow); box-shadow: var(--neo-lg), 0 0 12px rgba(var(--glow-rgb),0.1); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }

.phase-banner .btn-outline { color: var(--dim); }
.phase-banner .btn-outline:hover { color: var(--glow); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }


/* ════════════════════════════════════
   TOAST
   ════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1.8rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--neo-lg), 0 0 25px rgba(var(--glow-rgb),0.1);
  z-index: 999;
  animation: fadeIn 0.25s var(--ease);
  letter-spacing: -0.01em;
}

.hidden { display: none !important; }


/* ════════════════════════════════════
   EXERCISE LOGGER
   ════════════════════════════════════ */

.ex-table-wrap { overflow-x: auto; margin: 1.2rem 0 0.5rem; }

.ex-header {
  display: none;
}

#ex-rows .ex-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--neo-in-sm);
  position: relative;
}

#ex-rows .ex-row .ex-num {
  position: absolute;
  top: 12px;
  left: 12px;
}

#ex-rows .ex-row .ex-name {
  width: 100%;
  padding-left: 28px;
}

#ex-rows .ex-row .str-group,
#ex-rows .ex-row .run-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}

#ex-rows .ex-row .str-group { display: grid; }
#ex-rows .ex-row .run-group { display: none; }
#ex-table-wrap.run-mode #ex-rows .ex-row .str-group { display: none; }
#ex-table-wrap.run-mode #ex-rows .ex-row .run-group { display: grid; }

#ex-rows .ex-row .ex-del {
  position: absolute;
  top: 10px;
  right: 10px;
}

.ex-num { font-size: 0.72rem; color: var(--dim); text-align: center; font-weight: 800; }
.ex-h-num { text-align: center; }

.ex-row input {
  width: 100%;
  padding: 0.42rem 0.5rem;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  font-family: inherit;
  transition: all 0.3s var(--ease);
  min-width: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--neo-in-sm);
}
.ex-row .ex-name { font-size: 0.85rem; }
.ex-row input:focus { box-shadow: var(--neo-in-sm), 0 0 0 2px rgba(var(--glow-rgb),0.25); }
.ex-row input.field-error { box-shadow: var(--neo-in-sm), 0 0 0 2px rgba(160,85,85,0.35); }


.ex-del {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  transition: all 0.25s var(--ease);
  justify-self: center;
  opacity: 0.5;
}
.ex-del:hover { color: var(--red); opacity: 1; }

.btn-add-ex {
  margin-top: 1rem;
  background: var(--surface);
  border: none;
  color: var(--dim);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  width: 100%;
  transition: all 0.35s var(--ease);
  font-family: inherit;
  font-weight: 700;
  box-shadow: var(--neo);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background-image: var(--shine);
}
.btn-add-ex:hover { color: var(--glow); box-shadow: var(--neo-lg), 0 0 12px rgba(var(--glow-rgb),0.08); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }

.ex-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1.2rem;
}

.btn-discard {
  background: var(--surface);
  border: none;
  color: var(--dim);
  padding: 0.65rem 1.3rem;
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.35s var(--ease);
  font-family: inherit;
  font-weight: 700;
  box-shadow: var(--neo);
  background-image: var(--shine);
}
.btn-discard:hover { color: var(--red); box-shadow: var(--neo-lg); }

.wo-error {
  margin-top: 0.8rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  color: var(--red);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--neo-in-sm);
}


/* ════════════════════════════════════
   WORKOUT HISTORY
   ════════════════════════════════════ */

.no-workouts { font-size: 0.88rem; color: var(--dim); }

.wo-hist-item {
  border: none;
  border-radius: var(--r);
  margin-bottom: 1rem;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--neo);
  transition: all 0.4s var(--ease);
  background-image: var(--shine);
}

.wo-hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.2rem;
  gap: 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.wo-hist-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.wo-hist-type {
  font-weight: 800;
  font-size: 0.62rem;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  background: var(--surface);
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--neo-in-sm);
}
.wo-type-run { color: var(--green); }
.wo-type-hiit { color: var(--dim); }
.wo-type-power { color: var(--pink); }
.wo-type-hypertrophy { color: var(--glow); }
.wo-type-other { color: var(--faint); }

.wo-hist-date { color: var(--dim); font-size: 0.78rem; }
.wo-hist-dur { color: var(--dim); font-size: 0.78rem; }
.wo-hist-note { color: var(--text); font-size: 0.78rem; font-style: italic; opacity: 0.45; }

.btn-delete-wo {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.25rem;
  border-radius: 8px;
  transition: all 0.25s var(--ease);
  flex-shrink: 0;
  opacity: 0.15;
}
.btn-delete-wo:hover { opacity: 1; color: var(--red); }

.wo-ex-list { padding: 0.6rem 1.2rem 0.8rem; }

.wo-ex-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.wo-ex-row:last-child { border-bottom: none; }

.wo-ex-num { font-size: 0.68rem; color: var(--dim); min-width: 14px; text-align: right; font-weight: 800; }
.wo-ex-name { font-weight: 700; color: var(--text); font-size: 0.82rem; }
.wo-ex-detail { color: var(--dim); font-size: 0.78rem; }


/* ════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════ */

@media (max-width: 768px) {
  .summary-bar { grid-template-columns: repeat(2, 1fr); }
  .phase-banner { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1.2rem 1.5rem; }
  .form-row { flex-direction: column; }
  .page { padding: 0 1rem 2rem; }
  .page-tab { font-size: 0.65rem; padding: 0.6rem 0.15rem; letter-spacing: 0.04em; min-height: 44px; }
  .chart-card { padding: 1.5rem 1.2rem; }
  .log-section, .plan-section { padding: 1.5rem 1.2rem; }
  .header-inner { padding: 0.85rem 1.2rem; }
  .btn-primary, .btn-outline { min-height: 44px; }
  .cmd-banner { padding-left: calc(1.5rem + env(safe-area-inset-left, 0px)); padding-right: calc(1.5rem + env(safe-area-inset-right, 0px)); }
  .entry-modal { max-height: 80vh; max-height: 80dvh; }
}

@media (max-width: 480px) {
  .summary-bar { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; padding: 0 1rem; }
  .summary-card { padding: 1.1rem 0.9rem; }
  .summary-val { font-size: 1.3rem; }
  .header-inner { padding: 0.75rem 1rem; padding-left: calc(1rem + env(safe-area-inset-left, 0px)); padding-right: calc(1rem + env(safe-area-inset-right, 0px)); }
  .page-tabs { margin-left: 0.5rem; margin-right: 0.5rem; }
  .ex-row input { font-size: 16px; }
  .cmd-select { font-size: 16px; }
  .cmd-input { font-size: 16px; }
}

@media (max-width: 375px) {
  .summary-bar { gap: 0.6rem; padding: 0 0.6rem; }
  .summary-card { padding: 0.9rem 0.7rem; }
  .summary-val { font-size: 1.15rem; }
  .summary-lbl { font-size: 0.58rem; }
  .page { padding: 0 0.6rem 2rem; }
  .chart-card { padding: 1.2rem 0.8rem; }
  .log-section, .plan-section { padding: 1.2rem 0.8rem; }
  .page-tab { font-size: 0.58rem; letter-spacing: 0.02em; }
}


/* ════════════════════════════════════
   CHART POPUP
   ════════════════════════════════════ */

.chart-popup {
  position: absolute;
  transform: translate(-50%, -100%);
  margin-top: -12px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--neo-lg), 0 0 20px rgba(var(--glow-rgb),0.06);
  z-index: 1000;
  display: flex;
  overflow: hidden;
  animation: popupIn 0.2s var(--ease);
  background-image: var(--shine);
}

.chart-popup-item {
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: all 0.25s var(--ease);
  font-family: inherit;
}
.chart-popup-item:last-child { border-right: none; }
.chart-popup-item.popup-view { color: var(--silver); }
.chart-popup-item.popup-edit { color: var(--dim); }
.chart-popup-item.popup-delete { color: var(--red); font-size: 14px; }
.chart-popup-item:hover { color: var(--glow); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }
.chart-popup-item.popup-delete:hover { color: #884040; text-shadow: none; }

@keyframes popupIn {
  from { transform: translate(-50%, -100%) scale(0.9); opacity: 0; }
  to { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}


/* ════════════════════════════════════
   ENTRY MODAL
   ════════════════════════════════════ */

.entry-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,17,22,0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
}

.entry-modal {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--neo-lg);
  background-image: var(--shine);
  width: 100%;
  max-width: min(420px, calc(100vw - 2rem));
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

.entry-modal h3 {
  margin-bottom: 1.5rem;
  color: #b8917a;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.entry-modal h4 {
  margin: 1.5rem 0 0.6rem;
  font-size: 0.68rem;
  color: var(--dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.entry-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--dim);
  transition: all 0.25s var(--ease);
}
.entry-modal-close:hover { color: var(--glow); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }

.entry-modal-body p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.entry-modal-body label {
  display: block;
  margin: 0.8rem 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entry-modal-body label input,
.entry-modal-body label select {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem 0.9rem;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  transition: all 0.4s var(--ease);
  box-shadow: var(--neo-in);
  font-family: inherit;
  text-transform: none;
  letter-spacing: -0.01em;
  font-weight: 400;
}
.entry-modal-body label input:focus,
.entry-modal-body label select:focus { box-shadow: var(--neo-in), 0 0 0 2px rgba(var(--glow-rgb),0.25), 0 0 18px rgba(var(--glow-rgb),0.06); }

.entry-modal-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.8rem;
}

.entry-modal-actions .btn {
  flex: 1;
  padding: 0.7rem;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.35s var(--ease);
  font-family: inherit;
}

.entry-modal-actions .btn-primary {
  background: var(--surface);
  color: var(--silver);
  box-shadow: var(--neo);
  background-image: var(--shine);
}
.entry-modal-actions .btn-primary:hover { color: var(--glow); box-shadow: var(--neo-lg), 0 0 15px rgba(var(--glow-rgb),0.1); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }
.entry-modal-actions .btn-primary:active { box-shadow: var(--neo-in); }

.entry-modal-actions .btn-secondary {
  background: var(--surface);
  color: var(--dim);
  box-shadow: var(--neo-in);
}
.entry-modal-actions .btn-secondary:hover { color: var(--glow); text-shadow: 0 0 8px rgba(var(--glow-rgb),0.9), 0 0 25px rgba(var(--glow-rgb),0.5); }


/* ════════════════════════════════════
   VIEW / EDIT EXERCISE
   ════════════════════════════════════ */

.view-exercise {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  box-shadow: var(--neo-in-sm);
}

.view-ex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.view-ex-remove {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.view-ex-remove:hover { background: #884040; }

.view-ex-detail { margin-top: 0.25rem; color: var(--dim); font-size: 0.78rem; }

.edit-ex-card {
  background: var(--surface);
  border: none;
  border-radius: var(--r);
  padding: 0.85rem;
  margin-bottom: 0.6rem;
  box-shadow: var(--neo-in-sm);
}

.edit-ex-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.edit-ex-num {
  background: var(--faint);
  color: var(--text);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  flex-shrink: 0;
}

.edit-ex-header .edit-ex-name {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--neo);
}

.edit-ex-del {
  flex-shrink: 0;
  padding: 0.28rem 0.6rem;
  border-radius: 8px;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.edit-ex-del:hover { background: #884040; }

.edit-ex-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 0.4rem;
}

.edit-ex-fields label {
  font-size: 0.65rem !important;
  margin: 0 !important;
  color: var(--dim) !important;
}

.edit-ex-fields input {
  padding: 0.35rem 0.5rem !important;
  font-size: 0.82rem !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: var(--neo) !important;
  border: none !important;
  border-radius: 8px !important;
}


/* ════════════════════════════════════
   LEADERBOARD
   ════════════════════════════════════ */

.lb-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 600px) {
  .lb-grid { grid-template-columns: 1fr 1fr; }
}

.lb-card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 1.4rem 1.3rem;
  box-shadow: var(--neo);
  transition: all 0.4s var(--ease);
  background-image: var(--shine);
}

.lb-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  color: #b8917a;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.lb-sub {
  margin: 0 0 0.9rem;
  font-size: 0.72rem;
  color: var(--dim);
  font-weight: 500;
}
.lb-card ol { list-style: none; padding: 0; margin: 0; }
.lb-card li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.88rem;
}
.lb-card li:last-child { border-bottom: none; }
.lb-medal { font-size: 1.1rem; min-width: 1.4rem; text-align: center; }
.lb-rank { min-width: 1.4rem; text-align: center; font-weight: 800; color: var(--dim); font-size: 0.78rem; }
.lb-name { flex: 1; font-weight: 500; font-size: 0.88rem; }
.lb-val { font-weight: 800; color: var(--silver); font-size: 0.88rem; }
.lb-empty { color: var(--dim); font-size: 0.85rem; margin: 0; }
