:root {
  --brand-red: #d3112d;
  --brand-red-dark: #aa0f25;
  --brand-gold: #f7b21d;
  --brand-blue: #0d6aa8;
  --brand-bg: #f5f6f8;
  --text-main: #1f2937;
  --text-soft: #6b7280;
  --warning-bg: #fff3e8;
  --warning-border: #ff9f43;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  background-color: #ffffff;
  color: var(--text-main);
  font-family: 'Calibri', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.page-container {
  max-width: 1600px;
}

.form-select,
.form-control {
  font-family: 'Calibri', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.hero-header {
  background: radial-gradient(circle at top right, rgba(247,178,29,.16), transparent 25%), linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
  color: white;
  margin-bottom: 1.5rem;
  box-shadow: 0 18px 42px rgba(123, 8, 27, .18);
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-logo {
  width: 116px;
  max-width: 100%;
  background: rgba(255,255,255);
  border-radius: 18px;
  padding: 10px;
  flex: 0 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .24em;
  font-size: .72rem;
  opacity: .95;
  margin-bottom: .2rem;
}

.page-title {
  font-size: clamp(2rem, 4vw, 3.45rem);
  font-weight: 800;
  line-height: .98;
}

.page-subtitle {
  max-width: 720px;
  color: rgba(255,255,255,.9);
  font-size: 1.02rem;
}

.badge-soft {
  color: #7a0b20 !important;
  border-radius: 999px;
  padding: .55rem .85rem;
  font-weight: 700;
}

.filter-panel,
.metric-card,
.summary-box,
.day-card,
.empty-box,
.status-panel,
.loading-state {
  background: rgba(255,255,255,.97);
  border: 2px solid rgba(15,23,42,.06);
}

/* Estilos de card solo para mobile */
@media (max-width: 767px) {
  .filter-panel,
  .metric-card,
  .summary-box,
  .day-card,
  .empty-box,
  .status-panel,
  .loading-state {
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(15,23,42,.08);
  }
}

.filter-panel {
  padding: 1.25rem;
  margin-top: -1.15rem;
  position: relative;
  z-index: 2;
}

.form-label { font-weight: 700; }
.form-control, .form-select {
  border-radius: 14px;
  border-color: rgba(15,23,42,.12);
}
.btn-brand {
  background: linear-gradient(135deg, var(--brand-red), #ec6a31);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;

}
.btn-brand2 {
  background: linear-gradient(135deg, var(--brand-blue), #1237db);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;

}
.btn-brand:hover { color: white; opacity: .96; }
.note-text {
  padding: .35rem 0;
  line-height: 1.45;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.35rem 0;
}
.metric-card {
  padding: 1.05rem .95rem;
  text-align: center;
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.metric-card-warning {
  border: 2px solid var(--warning-border);
  background: linear-gradient(180deg, #fffaf4, #fff3e8);
  border-radius: 12px;
}
.metric-title {
  font-size: .95rem;
  font-weight: 700;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.metric-value { font-size: 2rem; font-weight: 800; color: var(--brand-blue); }
.metric-subtitle { color: var(--text-soft); font-size: .82rem; }

.status-panel { margin: 1rem 0 0; }
.totals-section { margin-bottom: 1.25rem; }
.summary-box {
  padding: 1rem 1.1rem;
  height: 100%;
}
.summary-box-accent { border: 1px solid rgba(211,17,45,.2); }
.summary-label {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .8rem;
  color: var(--brand-blue);
  font-weight: 800;
  margin-bottom: .7rem;
}
.summary-line { margin-bottom: .35rem; }

.loading-state {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.day-card {
  padding: 1rem;
  margin-bottom: 1rem;
}
.day-card-warning {
  border: 2px solid rgba(255,159,67,.55);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,248,241,.98));
}
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.day-title { font-size: 1.15rem; font-weight: 800; }
.day-subtitle { color: var(--text-soft); }
.day-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  margin-bottom: 1rem;
}
.summary-mini {
  background: #f8fafc;
  border: 1px solid rgba(15,23,42,.06);
  border-radius: 16px;
  padding: .9rem;
}
.summary-mini-title {
  font-weight: 800;
  margin-bottom: .4rem;
}

.comparison-table-wrap {
  border: 1px solid rgba(13,106,168,.12);
}
.comparison-table {
  margin: 0;
  font-size: .92rem;
}
.comparison-table thead th {
  background: #dff1fb;
  color: #12344d;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid rgba(13,106,168,.18);
}
.comparison-table thead th:nth-child(2),
.comparison-table thead th:nth-child(3) {
  text-align: right;
}
.comparison-table thead th:last-child {
  text-align: center;
}
.comparison-table tbody td { vertical-align: middle; }
.comparison-table tbody td:last-child { text-align: center; }

.comparison-table th,
.comparison-table td {
  padding: .9rem .65rem;
}
.comparison-table td.money-col,
.comparison-table th.money-col,
.comparison-table td:nth-child(2),
.comparison-table td:nth-child(3) {
  white-space: nowrap;
  text-align: right;
}
.comparison-table tbody tr:not(.mobile-card-row):hover td {
  background: #f8fbfe;
}
.day-card-warning .comparison-table tbody tr:not(.mobile-card-row):hover td {
  background: #fff8f1;
}
.diff-row td {
  background: var(--warning-bg) !important;
  border-color: rgba(255,159,67,.24);
}
.issue-list {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.issue-pill,
.issue-ok {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .28rem .6rem;
  font-size: .76rem;
  font-weight: 700;
}
.issue-pill {
  background: rgba(255,159,67,.14);
  color: #9a4d00;
}
.issue-ok {
  background: rgba(16,185,129,.12);
  color: #0b7a55;
}

.mobile-card-row { display: none; }
.mobile-card {
  display: none;
  border-radius: 16px;
  background: white;
  border: 1px solid rgba(15,23,42,.06);
  padding: .85rem;
}
.mobile-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .8rem;
  margin-bottom: .8rem;
}
.mobile-card-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  margin-bottom: .7rem;
}
.mobile-card-title { font-weight: 800; margin-bottom: .3rem; color: var(--brand-blue); }
.mobile-issues { margin-top: .4rem; }
.empty-box { padding: 1.6rem; text-align: center; color: var(--text-soft); }

@media (max-width: 1199px) {
  .page-container { max-width: 1240px; }
  .metrics-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Desktop grande - diseño expandido sin card */
@media (min-width: 1200px) {
  .filter-panel {
    border-radius: 6px;
  }
  .metric-card {
    border-radius: 6px;
  }
  .day-card {
    border-radius: 6px;
  }
  .summary-box {
    border-radius: 6px;
  }
}

@media (max-width: 991px) {
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-summary-grid { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
  .comparison-table {
    table-layout: auto;
    min-width: 100%;
  }
  /* Resultados en desktop - diseño expandido sin card */
  .day-card {
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
  }
  .comparison-table-wrap {
    border-radius: 20px;
  }
  .metric-card {
    border-radius: 20px;
  }
  .summary-box {
    border-radius: 20px;
  }
  .filter-panel {
    border-radius: 20px;
  }
}

@media (max-width: 767px) {
  .hero-header {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
  }
  .brand-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .brand-logo { width: 104px; }
  .eyebrow { letter-spacing: .18em; }
  .page-title { font-size: 2.15rem; }
  .page-subtitle { font-size: .96rem; }
  .filter-panel {
    margin-top: -1rem;
    padding: 1rem;
  }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 126px; }
  .day-header {
    flex-direction: column;
    align-items: flex-start;
  }
  /* Tabla en container con card */
  .comparison-table-wrap {
    border-radius: 18px;
    overflow: hidden;
  }
  /* Mostrar cards en mobile, ocultar tabla */
  .comparison-table thead,
  .comparison-table tbody tr:not(.mobile-card-row) { display: none; }
  .mobile-card-row { display: table-row; }
  .mobile-card { display: block; }
  .mobile-card-columns { grid-template-columns: 1fr; }
}


.module-nav-panel {
  margin-top: -0.6rem;
  margin-bottom: 1rem;
}

.module-nav {
  display: inline-flex;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 999px;
  padding: .35rem;
  gap: .35rem;
  box-shadow: 0 10px 28px rgba(15,23,42,.08);
}

.module-tab {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: .7rem 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.module-tab.active {
  background: linear-gradient(135deg, var(--brand-red), #ec6a31);
  color: white;
}

.price-list-note {
  color: var(--text-soft);
  font-weight: 700;
}

.summary-box-warning {
  border: 1px solid rgba(255,159,67,.35);
  background: linear-gradient(180deg, #fffdf9, #fff5ea);
}

.price-table td:last-child,
.price-table th:last-child {
  white-space: nowrap;
  text-align: center;
}

.mobile-card-warning {
  border-color: rgba(255,159,67,.35);
  background: #fff9f3;
}

@media (max-width: 767px) {
  .module-nav {
    display: flex;
    width: 100%;
  }

  .module-tab {
    flex: 1 1 0;
    text-align: center;
  }
}

.metrics-grid-ledger {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metric-value-money {
  font-size: 1.5rem;
}
.summary-box-warning {
  border: 2px solid var(--warning-border);
  background: linear-gradient(180deg, #fffaf4, #fff3e8);
}
.module-nav-panel {
  margin-bottom: 1rem;
}
.module-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.module-tab {
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  color: var(--text-main);
  border-radius: 999px;
  padding: .8rem 1.15rem;
  font-weight: 700;
}
.module-tab.active {
  background: linear-gradient(135deg, var(--brand-red), #ec6a31);
  color: #fff;
  border-color: transparent;
}
.price-list-note {
  color: var(--text-soft);
  font-weight: 700;
}
@media (max-width: 991px) {
  .metrics-grid-ledger {
    grid-template-columns: 1fr;
  }
}
