/* Valdez Magic — clean clinical theme */
:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-light: #ccfbf1;
  --bg: #f6fbfa;
  --card: #ffffff;
  --border: #d9e8e6;
  --text: #10312d;
  --muted: #5b7c77;
  --accent: #0ea5e9;
  --warn: #b45309;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", Inter, Roboto, sans-serif; min-height: 100vh; }

header { display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px; max-width: 900px; margin: 0 auto; flex-wrap: wrap; gap: 10px; }
.brand { display: flex; gap: 14px; align-items: center; }
.brand h1 { font-size: 1.7rem; letter-spacing: -.5px; }
.brand h1 span { color: var(--teal); }
.tag { color: var(--muted); font-size: .85rem; }
#user-chip { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .88rem; }

main, .auth-card { max-width: 900px; margin: 0 auto; padding: 0 16px 30px; }
main { display: flex; flex-direction: column; gap: 16px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; box-shadow: 0 2px 14px rgba(13,148,136,.05); }
.card h2 { font-size: 1.12rem; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepnum { background: var(--teal); color: #fff; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.muted { color: var(--muted); font-size: .9rem; line-height: 1.55; }
.muted a { color: var(--teal); }
.hidden { display: none !important; }
.badge { background: var(--teal-light); color: var(--teal-dark); border-radius: 999px;
  padding: 3px 12px; font-size: .72rem; font-weight: 700; }

button, .filebtn { border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 10px; padding: 12px 20px; font-size: .95rem; font-weight: 600; cursor: pointer; }
button.primary, .filebtn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
button.primary:hover, .filebtn.primary:hover { background: var(--teal-dark); }
button.ghost { background: transparent; }
button.big { width: 100%; padding: 15px; font-size: 1.05rem; margin-top: 14px; }
button.mini { padding: 5px 11px; font-size: .8rem; border-radius: 8px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.filebtn { display: inline-flex; align-items: center; gap: 8px; }

.auth-card { margin-top: 26px; max-width: 520px; }
.authrow { display: flex; gap: 10px; margin: 12px 0; }
.authrow input { flex: 1; }
input, select { border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  font-size: 1rem; background: #fff; color: var(--text); width: 100%; }

.scanrow { display: flex; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
#scan-status { margin-top: 8px; }
#scan-preview { width: 100%; max-height: 300px; border-radius: 12px; margin-top: 12px; background: #000; }

.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 9px; margin-top: 12px; }
.equip-item { border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 12px;
  cursor: pointer; font-size: .87rem; user-select: none; background: #fff; transition: all .15s; }
.equip-item.on { border-color: var(--teal); background: var(--teal-light); color: var(--teal-dark); font-weight: 700; }
.equip-item .tick { float: right; opacity: 0; }
.equip-item.on .tick { opacity: 1; }

.optgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 10px; }
.optgrid label { font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

#plan-summary { background: var(--teal-light); border-radius: 12px; padding: 14px 16px;
  margin: 10px 0 14px; color: var(--teal-dark); font-size: .92rem; line-height: 1.6; }
.day-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.day-tab { padding: 9px 15px; border-radius: 999px; border: 1.5px solid var(--border);
  cursor: pointer; font-size: .85rem; font-weight: 600; background: #fff; }
.day-tab.on { background: var(--teal); color: #fff; border-color: var(--teal); }

.ex { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ex-head strong { font-size: 1rem; }
.setsreps { color: var(--teal-dark); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.muscles { margin: 7px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.m-badge { background: var(--teal); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .7rem; font-weight: 700; }
.m-badge.sec { background: #94b8b3; }
.ex .how { font-size: .87rem; color: var(--text); margin-top: 6px; line-height: 1.5; }
.ex .why { font-size: .82rem; color: var(--muted); margin-top: 5px; font-style: italic; }
.phase { color: var(--muted); font-size: .85rem; margin: 10px 0; padding: 10px 14px;
  background: var(--bg); border-radius: 10px; }
.day-muscles { margin: 6px 0 12px; }
#coach-notes { margin-top: 14px; }
#coach-notes li { margin: 7px 0 7px 18px; font-size: .88rem; color: var(--muted); line-height: 1.5; }

/* chat */
#chat-fab { position: fixed; bottom: 20px; right: 20px; z-index: 50; background: var(--teal);
  color: #fff; border: none; border-radius: 999px; padding: 14px 22px; font-weight: 700;
  display: flex; align-items: center; gap: 9px; box-shadow: 0 10px 30px rgba(13,148,136,.35); }
#chat-panel { position: fixed; bottom: 20px; right: 20px; z-index: 60; width: 370px; max-width: calc(100vw - 24px);
  height: 480px; max-height: 72vh; background: #fff; border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(16,49,45,.25); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--teal-light); }
.chat-head button { margin-left: auto; }
#chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 13px; border-radius: 13px; font-size: .88rem; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 4px; }
.msg.valdez { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-inputrow { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-inputrow input { flex: 1; }
.chat-inputrow button { padding: 10px 16px; }

footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 26px 16px; }
footer a { color: var(--teal); }

@media (max-width: 600px) {
  header { padding: 16px 14px; }
  .brand h1 { font-size: 1.35rem; }
  .card { padding: 16px; border-radius: 12px; }
  .scanrow { flex-direction: column; }
  .scanrow > * { width: 100%; text-align: center; justify-content: center; }
  .authrow { flex-direction: column; }
  .equip-grid { grid-template-columns: 1fr 1fr; }
  #chat-panel { width: calc(100vw - 24px); height: 64vh; }
  .ex-head { flex-direction: column; gap: 2px; }
}
