:root {
  --bg: #eef4fb;
  --panel: #ffffff;
  --border: #d8e5f3;
  --text: #12263f;
  --muted: #64788f;
  --shadow: 0 12px 28px rgba(18, 38, 63, 0.08);

  --primary: #0d5fd3;
  --primary-2: #20a5ec;
  --dark: #0c2f67;

  --strength: #c70000;
  --run: #d1be00;
  --swim-dark: #102f65;
  --bike: #00a75a;
  --swim-blue: #0b6ec6;
  --mobility: #d79a18;
  --simulado: #6e3fd0;
  --domingo: #0099a8;
  --lazer: #7e8ea8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #edf4fb 0%, #f8fbff 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
}

.hero {
  background: linear-gradient(135deg, #0a2d6f, #1178cb);
  color: white;
  padding: 40px 0 32px;
}

.hero-tag {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.9;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 6vw, 3rem);
}

.hero-text {
  margin: 0;
  max-width: 760px;
  line-height: 1.6;
  opacity: 0.96;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.app {
  padding: 18px 0 42px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
}

.btn-secondary {
  background: #edf4ff;
  color: #194681;
}

.hidden {
  display: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: bold;
  background: #e8f8ef;
  color: #0b7f45;
}

.status-badge.offline {
  background: #ffe9e9;
  color: #a32020;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.top-controls {
  grid-template-columns: repeat(4, 1fr);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-size: 0.92rem;
  font-weight: bold;
}

.field input,
.field select,
.field textarea {
  border: 1px solid #cfdbec;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.96rem;
  outline: none;
  background: white;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 95, 211, 0.12);
}

.field-full {
  grid-column: 1 / -1;
}

.field-end {
  justify-content: flex-end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  font-size: 1.3rem;
}

.top-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  margin-bottom: 18px;
}

.highlight-box,
.simulado-box {
  background: #f6faff;
  border: 1px solid #dce8f4;
  border-radius: 18px;
  padding: 16px;
  line-height: 1.6;
}

.badge {
  display: inline-block;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: bold;
  background: #e8f2ff;
  color: #0f4fb3;
}

.mode-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.mode-btn {
  border: 1px solid #cfe0f2;
  background: #f8fbff;
  color: #173f70;
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: bold;
  cursor: pointer;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  border-color: transparent;
}

.week-planner {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.day-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  min-height: 260px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 22px rgba(18, 38, 63, 0.06);
}

.day-card::before {
  content: "";
  display: block;
  height: 10px;
  width: 100%;
}

.day-card.strength::before { background: var(--strength); }
.day-card.run::before { background: var(--run); }
.day-card.swim-dark::before { background: var(--swim-dark); }
.day-card.bike::before { background: var(--bike); }
.day-card.swim-blue::before { background: var(--swim-blue); }
.day-card.mobility::before { background: var(--mobility); }
.day-card.longao::before { background: var(--domingo); }
.day-card.lazer::before { background: var(--lazer); }
.day-card.simulado::before { background: var(--simulado); }

.day-card.is-today {
  outline: 3px solid rgba(13, 95, 211, 0.12);
}

.day-head {
  padding: 12px 12px 8px;
}

.day-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.day-short,
.day-date {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: bold;
}

.today-tag {
  display: inline-block;
  margin-top: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: bold;
  background: #edf4ff;
  color: var(--primary);
}

.day-body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.day-title {
  margin: 8px 0;
  font-size: 0.98rem;
  line-height: 1.35;
}

.day-duration {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: bold;
}

.day-description {
  margin-bottom: 12px;
  color: #334860;
  font-size: 0.92rem;
  line-height: 1.5;
}

.day-extra {
  margin-bottom: 14px;
  background: #f7fbff;
  border-radius: 14px;
  padding: 10px;
  color: #51657d;
  font-size: 0.88rem;
  line-height: 1.5;
}

.checkbox-wrap {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fbff;
  border-radius: 14px;
  padding: 10px;
  font-size: 0.88rem;
}

.checkbox-wrap input {
  width: 18px;
  height: 18px;
}

.calendar-head {
  align-items: center;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  border: none;
  background: #edf4ff;
  color: #18447e;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 10px;
  text-align: center;
  font-weight: bold;
  color: var(--muted);
}

.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-cell {
  min-height: 112px;
  background: white;
  border: 1px solid #dce8f4;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-cell.outside {
  opacity: 0.42;
  background: #f7f9fc;
}

.calendar-cell.today {
  outline: 3px solid rgba(13, 95, 211, 0.12);
}

.calendar-cell.simulado-day {
  background: linear-gradient(180deg, #fbf7ff 0%, #f4ecff 100%);
  border-color: #d9c5ff;
}

.calendar-date-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.calendar-date {
  font-weight: bold;
}

.calendar-mini-label {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

.pill {
  align-self: flex-start;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.68rem;
  font-weight: bold;
  color: white;
}

.pill.forca { background: var(--strength); }
.pill.corrida { background: #b5a300; }
.pill.natacao { background: var(--swim-blue); }
.pill.bike { background: var(--bike); }
.pill.mobilidade { background: var(--mobility); color: #2b2200; }
.pill.longao { background: var(--domingo); }
.pill.lazer { background: var(--lazer); }
.pill.simulado { background: var(--simulado); }

.analytics-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.chart-card {
  background: #fbfdff;
  border: 1px solid #dce8f4;
  border-radius: 18px;
  padding: 16px;
}

.chart-card h3,
.bars-title {
  margin-top: 0;
  margin-bottom: 14px;
}

#evolutionChart {
  width: 100%;
  height: 280px;
  display: block;
}

.performance-bars {
  display: grid;
  gap: 14px;
}

.performance-item {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  gap: 12px;
  align-items: center;
}

.performance-label {
  font-weight: bold;
}

.performance-track {
  height: 14px;
  background: #edf3fb;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #dce7f4;
}

.performance-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.performance-value {
  text-align: right;
  color: var(--muted);
  font-weight: bold;
}

.tips-clouds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tip-cloud {
  position: relative;
  background: #f9fcff;
  border: 1px solid #dbe6f4;
  border-radius: 42px;
  padding: 22px 18px 18px;
  min-height: 210px;
}

.tip-cloud::before,
.tip-cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #f9fcff;
  border: 1px solid #dbe6f4;
  z-index: -1;
}

.tip-cloud::before {
  width: 48px;
  height: 48px;
  left: 22px;
  top: -14px;
}

.tip-cloud::after {
  width: 56px;
  height: 56px;
  right: 26px;
  top: -18px;
}

.tip-cloud h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.tip-cloud ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
  color: #364a63;
}

.tip-cloud li + li {
  margin-top: 7px;
}

.simulado-box {
  margin-bottom: 16px;
}

.simulados-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.simulado-item {
  background: #fbfdff;
  border: 1px solid #dce8f4;
  border-radius: 16px;
  padding: 14px;
  line-height: 1.5;
}

.entries-summary {
  margin: 18px 0 14px;
  background: #f8fbff;
  border: 1px solid #dce8f4;
  border-radius: 16px;
  padding: 14px 16px;
  line-height: 1.55;
  color: #334860;
}

.entries-list {
  display: grid;
  gap: 12px;
}

.entry-card {
  background: white;
  border: 1px solid #dce8f4;
  border-radius: 16px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.entry-card h4 {
  margin: 0 0 8px;
}

.entry-meta {
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.entry-note {
  color: #364a63;
  line-height: 1.5;
}

.delete-entry-btn {
  border: none;
  background: #ffe9e9;
  color: #941e1e;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: bold;
  cursor: pointer;
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 6px 0 30px;
}

/* Tablet */
@media (max-width: 1100px) {
  .stats-grid,
  .top-controls,
  .tips-clouds,
  .simulados-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .top-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .week-planner {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Celular */
@media (max-width: 700px) {
  .container {
    width: 94%;
  }

  .hero {
    padding: 28px 0 24px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .panel-head {
    flex-direction: column;
  }

  .stats-grid,
  .top-controls,
  .form-grid,
  .tips-clouds,
  .simulados-list,
  .week-planner,
  .month-calendar {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays {
    display: none;
  }

  .calendar-cell {
    min-height: 92px;
  }

  .performance-item {
    grid-template-columns: 1fr;
  }

  .performance-value {
    text-align: left;
  }

  .entry-card {
    grid-template-columns: 1fr;
  }

  #evolutionChart {
    height: 240px;
  }
}