/* ----------------------------------------------------
   Calculadora de Interés Compuesto (1 Año por Ciclos)
   Estilo: Mobile-First Native App Design (COP)
---------------------------------------------------- */

:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #cbd5e1;
  --border-strong: #94a3b8;

  --text-main: #0f172a;
  --text-sub: #334155;
  --text-muted: #64748b;

  --emerald-main: #047857;
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;

  --cyan-main: #0284c7;
  --cyan-bg: #f0f9ff;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-hero: 0 8px 24px rgba(4, 120, 87, 0.15);

  --font-body: 'Inter', -apple-system, sans-serif;
  --font-head: 'Outfit', -apple-system, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

.mobile-app-wrapper {
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.85rem;
}

/* App Bar */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.app-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon-mini {
  color: var(--emerald-main);
}

.app-bar-brand h2 {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-cop {
  font-size: 0.7rem;
  background: var(--emerald-bg);
  color: var(--emerald-main);
  border: 1px solid var(--emerald-border);
  padding: 0.1rem 0.4rem;
  border-radius: 12px;
  font-weight: 700;
}

.year-tag {
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--cyan-bg);
  color: var(--cyan-main);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  border: 1px solid #bae6fd;
}

/* App Main Grid */
.app-main {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Featured Hero KPI Card (Top Priority on Mobile) */
.featured-kpi-card {
  background: linear-gradient(135deg, #047857, #065f46);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.1rem;
  box-shadow: var(--shadow-hero);
  text-align: center;
}

.kpi-top-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  opacity: 0.9;
  display: block;
}

.kpi-hero-amount {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  margin: 0.25rem 0;
  line-height: 1.15;
  color: #ffffff;
}

.kpi-hero-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.hero-sub-item {
  opacity: 0.95;
}

.dot-separator {
  opacity: 0.5;
}

.hero-sub-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-weight: 800;
}

/* Form Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.card-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--emerald-main);
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.card-section-title h3 {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.field-block {
  margin-bottom: 0.9rem;
}

.field-block:last-child {
  margin-bottom: 0;
}

.field-block label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-container input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  background: #ffffff;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 16px; /* Prevents mobile auto-zoom */
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-container input:focus {
  border-color: var(--emerald-main);
}

.prefix {
  position: absolute;
  left: 0.85rem;
  color: var(--emerald-main);
  font-weight: 800;
  font-size: 1rem;
  pointer-events: none;
}

.suffix {
  position: absolute;
  right: 0.85rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  pointer-events: none;
}

.input-container input:has(~ .prefix) {
  padding-left: 2rem;
}

.input-container input:has(~ .suffix) {
  padding-right: 4.5rem;
}

/* 4-Button Grid for Presets (Perfect on Mobile) */
.button-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.grid-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.55rem 0.2rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.grid-chip.active {
  background: var(--emerald-main);
  border-color: var(--emerald-main);
  color: #ffffff;
}

input[type="range"] {
  width: 100%;
  margin-top: 0.45rem;
  accent-color: var(--emerald-main);
  height: 6px;
  cursor: pointer;
}

/* Segmented Control Navigation */
.segmented-control {
  display: flex;
  background: #e2e8f0;
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.segment-btn {
  flex: 1;
  padding: 0.65rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.segment-btn.active {
  background: #ffffff;
  color: var(--emerald-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Tab Views */
.views-card {
  padding: 0.85rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.chart-box {
  position: relative;
  width: 100%;
  height: 250px;
}

/* Mobile Table Styling */
.table-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  font-weight: 800;
  font-size: 0.9rem;
}

.export-mini-btn {
  background: var(--cyan-main);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.mobile-table-wrapper {
  overflow-x: auto;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

.mobile-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.mobile-data-table th {
  position: sticky;
  top: 0;
  background: #e2e8f0;
  color: var(--text-main);
  font-family: var(--font-head);
  font-weight: 800;
  padding: 0.65rem 0.6rem;
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}

.mobile-data-table td {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-weight: 600;
}

tr.final-cycle-row {
  background: var(--emerald-bg) !important;
  border-top: 2px solid var(--emerald-main);
  border-bottom: 2px solid var(--emerald-main);
  font-weight: 800;
}

.text-emerald {
  color: var(--emerald-main);
  font-weight: 700;
}

.app-footer {
  text-align: center;
  padding: 0.75rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ====================================================
   DESKTOP / WIDESCREEN ENHANCEMENT (>= 768px)
==================================================== */
@media (min-width: 768px) {
  .mobile-app-wrapper {
    max-width: 1050px;
    padding: 1.5rem;
    gap: 1.25rem;
  }

  .app-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    align-items: start;
    gap: 1.25rem;
  }

  .featured-kpi-card {
    grid-column: 1 / -1;
    padding: 1.5rem;
  }

  .kpi-hero-amount {
    font-size: 2.6rem;
  }

  .chart-box {
    height: 340px;
  }
}
