/* ===================================================================
   Fatigue Radar — Recomendador (app)
   =================================================================== */

.app-body { background: #f0f4fc; min-height: 100vh; }

.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-header__inner {
  max-width: 1400px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.app-header__title { display: flex; flex-direction: column; line-height: 1.2; }
.app-header__title strong { color: var(--blue); font-size: 1.05rem; }
.app-header__sub { font-size: .78rem; color: var(--ink-soft); }
.app-header__chip {
  margin-left: auto; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #b7791f; background: rgba(240,200,80,.15);
  border: 1px solid rgba(240,200,80,.45); padding: 5px 12px; border-radius: 100px;
}
.btn--tiny { padding: 8px 16px; font-size: .85rem; }

.app-shell {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: 280px 1fr; gap: 0;
  min-height: calc(100vh - 58px);
}

/* Sidebar */
.app-sidebar {
  background: var(--white); border-right: 1px solid var(--line);
  padding: 24px 20px; display: flex; flex-direction: column; gap: 24px;
}
.app-sidebar__block { display: flex; flex-direction: column; gap: 8px; }
.app-sidebar__info { font-size: .82rem; color: var(--ink-soft); line-height: 1.55; }
.app-sidebar__info p + p { margin-top: 10px; }
.app-label { font-weight: 600; font-size: .88rem; color: var(--ink); }
.app-hint { font-size: .76rem; color: var(--ink-soft); }
.app-input, .app-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-family: inherit; font-size: .92rem;
}
.app-range { width: 100%; accent-color: var(--blue); cursor: pointer; }

/* Main */
.app-main { padding: 24px; overflow-x: hidden; }
.app-loading { text-align: center; padding: 80px 20px; color: var(--ink-soft); }
.app-content { display: flex; flex-direction: column; gap: 20px; }

/* KPIs */
.app-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.app-kpi {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.app-kpi__v { font-family: 'Anton', sans-serif; font-size: 1.9rem; color: var(--blue); line-height: 1; }
.app-kpi__v--warn { color: #d9640a; }
.app-kpi__v--good { color: #0aa876; }
.app-kpi__l { font-size: .82rem; color: var(--ink-soft); margin-top: 6px; }

/* Tabs */
.app-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.app-tab {
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 12px 18px; font-family: inherit; font-weight: 600; font-size: .92rem;
  color: var(--ink-soft); cursor: pointer; margin-bottom: -1px; transition: color .2s, border-color .2s;
}
.app-tab:hover { color: var(--blue); }
.app-tab.is-active { color: var(--blue); border-bottom-color: var(--green); }
.app-panel { display: none; flex-direction: column; gap: 18px; }
.app-panel.is-active { display: flex; }
.app-panel__head { display: flex; flex-direction: column; gap: 6px; }
.app-h1 { font-family: 'Anton', sans-serif; font-size: 1.6rem; color: var(--blue); text-transform: uppercase; font-weight: 400; }
.app-panel__sub { color: var(--ink-soft); font-size: .95rem; }

/* Table */
.app-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.app-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 900px; }
.app-table th {
  text-align: left; padding: 12px 14px; background: var(--blue-bg);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.app-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.app-table tbody tr { transition: background .2s; cursor: pointer; }
.app-table tbody tr:hover { background: var(--blue-bg); }
.app-table tbody tr.is-alert { background: rgba(229,72,77,.06); }
.app-table tbody tr.is-selected { outline: 2px solid var(--blue-light); outline-offset: -2px; }
.app-table--compact { min-width: 700px; }
.app-table .score-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.app-table .score-num { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 36px; }
.app-legend { font-size: .82rem; color: var(--ink-soft); }

/* Detail */
.app-detail-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.app-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.app-chartbox {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.app-chartbox h3 { font-size: .92rem; color: var(--blue); margin-bottom: 10px; }
.app-chartbox canvas { width: 100%; height: auto; display: block; }
.app-chartbox--wide { grid-column: 1 / -1; }
.app-chart-legend { font-size: .76rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.lg { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.lg--real { background: #2E86AB; }
.lg--pred { background: #DD8452; }
.lg--fs { background: #C44E52; }
.lg--fsreal { background: #999; border-top: 1px dashed #999; height: 0; }

/* SHAP */
.app-shap { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.app-shap h3 { font-size: .95rem; color: var(--blue); margin-bottom: 14px; }
.app-shap__bars { display: flex; flex-direction: column; gap: 8px; }
.shap-row { display: grid; grid-template-columns: 140px 1fr 52px; gap: 10px; align-items: center; font-size: .82rem; }
.shap-row__lbl { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shap-row__track { height: 10px; background: #eef2f8; border-radius: 5px; position: relative; overflow: hidden; }
.shap-row__fill { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.shap-row__fill--pos { background: #C44E52; left: 50%; }
.shap-row__fill--neg { background: #2E86AB; right: 50%; }
.shap-row__val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.shap-row__val--pos { color: #C44E52; }
.shap-row__val--neg { color: #2E86AB; }
.app-shap__read { margin-top: 14px; padding: 12px 14px; background: var(--blue-bg); border-radius: 10px; font-size: .88rem; color: var(--ink); }

/* Recommendation box */
.app-recbox {
  background: linear-gradient(135deg, rgba(0,47,189,.06), rgba(0,224,160,.08));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
}
.app-recbox__action { font-family: 'Anton', sans-serif; font-size: 1.3rem; color: var(--blue); }
.app-recbox__meta { font-size: .88rem; color: var(--ink-soft); flex: 1; min-width: 200px; }
.app-recbox__eur { font-size: 1.1rem; font-weight: 700; color: #0aa876; }

/* Impact cards */
.app-impact-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.app-icard { border-radius: var(--radius); padding: 20px; color: #fff; }
.app-icard--good { background: linear-gradient(135deg, #002FBD, #3D6EFF); }
.app-icard--bad { background: linear-gradient(135deg, #5a1a2a, #C44E52); }
.app-icard--neu { background: linear-gradient(135deg, #1a3a6e, #2E86AB); }
.app-icard__lbl { font-size: .78rem; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.app-icard__num { font-family: 'Anton', sans-serif; font-size: 2rem; margin: 6px 0; }
.app-icard__sub { font-size: .82rem; opacity: .9; }

.app-fig { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.app-fig img { width: 100%; padding: 12px; background: #fff; }
.app-fig figcaption { padding: 12px 16px; font-size: .85rem; color: var(--ink-soft); border-top: 1px solid var(--line); }

/* Responsive */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; }
  .app-sidebar__block { flex: 1; min-width: 200px; }
  .app-kpis, .app-detail-kpis { grid-template-columns: repeat(2, 1fr); }
  .app-charts { grid-template-columns: 1fr; }
  .app-impact-cards { grid-template-columns: 1fr; }
  .app-header__chip { margin-left: 0; }
}
@media (max-width: 520px) {
  .app-kpis, .app-detail-kpis { grid-template-columns: 1fr; }
  .app-main { padding: 16px; }
}
