/* ============================================================
   RADIANT — Panel del coach · claro, elegante, funcional
   Misma base que la app del atleta; aquí vive el lenguaje técnico.
   ============================================================ */

:root {
  --bg: #f2f3ef;
  --card: #ffffff;
  --ink: #182720;
  --ink-2: #5f6b64;
  --ink-3: #9aa39c;
  --line: #e8eae4;
  --forest: #1e3229;
  --forest-2: #2a4437;
  --ember: #e8650f;
  --ember-soft: #fdeee1;
  --danger: #c2453a;
  --warn: #b0691c;
  --font-head: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --r-lg: 18px;
  --r-md: 13px;
  --shadow: 0 1px 2px rgba(23, 32, 26, 0.04), 0 6px 20px rgba(23, 32, 26, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }

.panel { display: flex; min-height: 100vh; position: relative; }
.ember-glow, .grain { display: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 232px; flex: 0 0 auto; z-index: 2;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--card);
  padding: 24px 14px 18px;
  position: sticky; top: 0; height: 100vh;
}
.wordmark {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 24px;
  font-family: var(--font-head); font-weight: 700; font-size: 14px; letter-spacing: 0.26em;
  color: var(--ink);
}
.wordmark span { display: flex; flex-direction: column; line-height: 1.25; }
.wordmark small { font-size: 9px; letter-spacing: 0.1em; font-weight: 600; color: var(--ink-3); }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-item {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  background: none; border: none; border-radius: 11px;
  padding: 11px 12px; cursor: pointer; text-align: left;
  transition: all 0.18s;
}
.side-item svg { width: 19px; height: 19px; flex: 0 0 auto; }
.side-item:hover { color: var(--ink); background: var(--bg); }
.side-item.is-active { color: #fff; background: var(--forest); }
.side-count {
  margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--ink-2);
  background: var(--bg); padding: 2px 7px; border-radius: 999px;
}
.side-item.is-active .side-count { color: #fff; background: rgba(255, 255, 255, 0.18); }
.side-foot {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); padding: 16px 8px 0;
}
.side-coach { font-size: 13px; font-weight: 700; }
.side-role { font-size: 11px; color: var(--ink-3); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-body); font-weight: 700; font-size: 12px; color: #fff;
  background: var(--forest);
  border: none; flex: 0 0 auto;
}
.avatar--client { width: 48px; height: 48px; font-size: 15px; }

/* ---------- Contenido ---------- */
.content { flex: 1; z-index: 1; padding: 30px 34px 60px; min-width: 0; }
.view { display: none; animation: viewIn 0.25s ease both; }
.view.is-active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.view-head h1, .client-id h1 { font-family: var(--font-body); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.view-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4caf6d; }

/* ---------- Botones ---------- */
.btn-ember {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 700; font-size: 14px;
  color: #fff;
  background: var(--forest);
  border: none; border-radius: 999px; padding: 12px 22px; cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.btn-ember:hover { background: var(--forest-2); }
.btn-ember:active { transform: scale(0.97); }
.btn-sm { padding: 10px 18px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-ghost {
  font-family: var(--font-body); font-weight: 600; font-size: 13px; color: var(--ink);
  background: var(--card); border: 1.5px dashed #cdd1c9;
  border-radius: 999px; padding: 12px 20px; cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--forest); }
.btn-back {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); border: none; box-shadow: var(--shadow); color: var(--ink);
  cursor: pointer; flex: 0 0 auto;
}

/* ---------- Stats ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--card);
  border: none; border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-big { font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.stat-unit { font-size: 16px; color: var(--ink-3); margin-left: 3px; font-weight: 600; }
.stat-lab { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-top: 8px; }
.stat-card--alert .stat-big { color: var(--warn); }
.stat-card--glow .stat-big { color: var(--ember); }

/* ---------- Tablas ---------- */
.table-card {
  background: var(--card);
  border: none; border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden; overflow-x: auto;
}
.table-card.pad { padding: 20px; overflow: visible; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
  text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 13px 16px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
.client-table tbody tr { cursor: pointer; }
.client-table tbody tr:hover { background: #f7f8f4; }

.cl-name { display: flex; align-items: center; gap: 11px; font-weight: 700; }
.adh-bar { display: flex; align-items: center; gap: 9px; min-width: 130px; }
.adh-track { display: block; flex: 1; height: 6px; border-radius: 6px; background: #e9ebe5; overflow: hidden; }
.adh-fill { display: block; height: 100%; border-radius: 6px; background: var(--forest); }
.adh-fill.low { background: var(--danger); }
.adh-num { font-weight: 700; font-size: 12.5px; min-width: 34px; }
.wl-badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.wl-ok { color: #2c6e46; background: #e7efe6; }
.wl-warn { color: var(--warn); background: #faeeda; }
.wl-alert { color: var(--danger); background: #fbe9e7; }
.row-open { color: var(--ink-3); }

/* ---------- Ficha cliente ---------- */
.client-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.client-id { flex: 1; min-width: 200px; }
.e1rm-inputs { display: flex; gap: 10px; }
.e1rm-inputs label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}
.e1rm-inputs input {
  width: 86px;
  font-family: var(--font-body); font-weight: 700; font-size: 17px; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 8px 10px; outline: none; text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.e1rm-inputs input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(30, 50, 41, 0.1); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  font-family: var(--font-body); font-size: 13.5px; font-weight: 700; color: var(--ink-3);
  background: none; border: none; padding: 11px 16px; cursor: pointer; position: relative;
  transition: color 0.2s;
}
.tab.is-active { color: var(--ink); }
.tab.is-active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px;
  background: var(--forest);
  border-radius: 3px;
}
.tab-pane { display: none; }
.tab-pane.is-active { display: block; animation: viewIn 0.2s ease both; }

/* ---------- Builder ---------- */
.builder-top { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.week-pills, .day-pills { display: flex; gap: 7px; }
.pill {
  font-family: var(--font-body); font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  background: #e9ebe5; border: none; border-radius: 999px;
  padding: 9px 15px; cursor: pointer; transition: all 0.2s;
}
.pill.is-active { color: #fff; background: var(--forest); }
.hint {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--ink-2);
  border-radius: var(--r-md);
  background: #e9ebe5;
  padding: 11px 14px; margin-bottom: 14px;
}
.hint svg { color: var(--ink-2); flex: 0 0 auto; }
.hint strong { color: var(--ink); }

.builder-table td { padding: 9px 16px; }
.builder-table .ex-name { font-weight: 700; white-space: nowrap; }
.builder-table select, .builder-table input {
  font-family: var(--font-body); font-weight: 600; font-size: 13px; color: var(--ink);
  background: var(--bg); border: 1px solid transparent; border-radius: 8px;
  padding: 7px 9px; outline: none; transition: border-color 0.2s;
}
.builder-table select:focus, .builder-table input:focus { border-color: var(--forest); background: #fff; }
.builder-table input[type="number"] { width: 58px; text-align: center; }
.bl-tag { font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; padding: 4px 9px; border-radius: 7px; background: var(--bg); color: var(--ink-2); }
.bl-tag.main { color: #944200; background: var(--ember-soft); }
.load-cell {
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink);
  white-space: nowrap; transition: color 0.2s;
}
.load-cell.flash { animation: loadFlash 0.6s ease; }
@keyframes loadFlash { 0% { color: var(--ember); } 100% { color: var(--ink); } }
.load-cell.na { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.builder-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 12px; flex-wrap: wrap; }

/* ---------- Nutrición coach ---------- */
.nutri-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
.card-h { font-size: 16px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.01em; }
.card-h-sub { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.calc-grid label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3);
}
.calc-grid input, .calc-grid select {
  font-family: var(--font-body); font-weight: 600; font-size: 13.5px; color: var(--ink);
  background: var(--bg); border: 1px solid transparent; border-radius: 9px;
  padding: 9px 10px; outline: none; width: 100%;
  transition: border-color 0.2s;
}
.calc-grid input:focus, .calc-grid select:focus { border-color: var(--forest); background: #fff; }
.calc-out {
  display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line);
}
.calc-big { font-size: 25px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.calc-big span { font-size: 13px; color: var(--ink-3); margin-left: 4px; font-weight: 600; }
.calc-lab { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); margin-top: 7px; }
.calc-hero { border-left: 1px solid var(--line); padding-left: 16px; }
.calc-hero .calc-big { color: var(--ember); }

.portions-table th, .portions-table td { text-align: center; padding: 9px 6px; }
.portions-table th:first-child, .portions-table td:first-child { text-align: left; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: var(--bg); border: none; color: var(--ink-2);
  font-size: 13px; font-weight: 700; cursor: pointer; line-height: 1;
  transition: all 0.15s;
}
.stepper button:hover { color: #fff; background: var(--forest); }
.stepper b { font-size: 14px; font-weight: 700; min-width: 16px; }
.portions-table tfoot td {
  font-weight: 700; color: var(--ink);
  border-top: 1px solid var(--line); padding-top: 12px;
}

/* ---------- Registro ---------- */
.log-table .pres { color: var(--ink-2); white-space: nowrap; }
.log-table .real { font-weight: 700; }
.log-table .e1 { font-weight: 700; color: var(--ember); }
.log-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }

/* ---------- Biblioteca ---------- */
.lib-controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: none; box-shadow: var(--shadow); border-radius: 999px;
  padding: 11px 16px; max-width: 380px; color: var(--ink-3);
}
.search input {
  flex: 1; background: none; border: none; outline: none; color: var(--ink);
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
}
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
  background: #e9ebe5; border: none; border-radius: 999px;
  padding: 8px 14px; cursor: pointer; transition: all 0.2s;
}
.chip.is-active { color: #fff; background: var(--forest); }
.lib-table .coef { font-weight: 700; color: var(--ink-2); }
.lib-video { color: var(--ink); display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.lib-foot { padding: 13px 16px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); }

/* ---------- Plantillas ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tpl-card {
  background: var(--card);
  border: none; border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px; cursor: pointer;
  transition: transform 0.18s;
}
.tpl-card:hover { transform: translateY(-2px); }
.tpl-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.tpl-meta { font-size: 12.5px; color: var(--ink-2); margin: 5px 0 14px; }
.tag { font-size: 11px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--bg); color: var(--ink-2); }
.tag-ember { color: #944200; background: var(--ember-soft); }
.tpl-card--new {
  display: grid; place-items: center;
  background: transparent; box-shadow: none;
  border: 1.5px dashed #cdd1c9;
  color: var(--ink-2); font-weight: 700; font-size: 14px; min-height: 120px;
}
.tpl-card--new:hover { border-color: var(--forest); color: var(--ink); }

/* ---------- Ajustes ---------- */
.settings-card { max-width: 640px; }
.row-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 0; font-size: 14px; font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.row-item:last-child { border-bottom: none; }
.row-value { color: var(--ink-3); font-weight: 500; }

/* ---------- Toast ---------- */
.publish-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 10px; z-index: 80;
  background: var(--forest);
  color: #fff; font-weight: 700; font-size: 13.5px;
  border-radius: 999px; padding: 13px 22px;
  box-shadow: 0 14px 44px rgba(23, 32, 26, 0.3);
  opacity: 0; pointer-events: none;
  transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.publish-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.publish-toast svg { color: #8fd0a3; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nutri-grid { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { width: 68px; padding: 20px 10px; }
  .wordmark span, .side-item { font-size: 0; }
  .wordmark { justify-content: center; padding-bottom: 20px; }
  .side-item { justify-content: center; gap: 0; padding: 12px; }
  .side-count, .side-foot div { display: none; }
  .side-foot { justify-content: center; }
  .content { padding: 22px 18px 50px; }
  .stats-row, .log-cards { grid-template-columns: repeat(2, 1fr); }
  .e1rm-inputs { width: 100%; }
}
