/* =============================================
   QKapital Group · 12/24 Month Bank Statement
   Income Worksheet · styles.css
   Paleta: Rojo #C0111F · Negro #1A1A1A · Blanco
   ============================================= */

:root {
  --red:        #C0111F;
  --red-light:  #E8303F;
  --red-bg:     #FFF5F5;
  --red-border: #FFBCBC;
  --black:      #1A1A1A;
  --white:      #FFFFFF;
  --gray-100:   #F7F7F7;
  --gray-200:   #EBEBEB;
  --gray-300:   #DDDDDD;
  --gray-400:   #AAAAAA;
  --gray-500:   #888888;
  --gray-600:   #555555;
  --text:       #1A1A1A;
  --text-soft:  #555555;
  --green:      #1F8A4C;
  --green-bg:   #F0FBF4;
  --amber:      #B45309;
  --amber-bg:   #FFFBEB;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-100);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ── TOP BAR ─────────────────────────────── */
.top-bar {
  background: var(--black);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--red);
}

.logo-area { display: flex; align-items: center; gap: 12px; }
.logo-img  { height: 36px; object-fit: contain; }
.logo-divider {
  width: 1px; height: 28px;
  background: rgba(255,255,255,0.2);
}
.logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
}
.logo-sub strong {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

/* ── LANGUAGE TOGGLE ─────────────────────── */
.lang-toggle {
  display: flex;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}
.lang-btn {
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}
.lang-btn.active { background: var(--red); color: var(--white); }

/* ── HERO ────────────────────────────────── */
.hero {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 18px 20px 16px;
}
.hero h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--black);
  letter-spacing: -0.3px;
}
.hero h1 span { color: var(--red); }
.hero p {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}

/* ── CONTENT ─────────────────────────────── */
.content {
  padding: 14px;
  max-width: 720px;
  margin: 0 auto;
}

.section-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
  font-weight: 700;
}

/* ── CARDS ───────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* ── FORMULA BANNER ──────────────────────── */
.formula {
  background: var(--white);
  border: 1px solid var(--red-border);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 12px;
  line-height: 1.5;
}
.formula strong { color: var(--red); font-weight: 700; }

/* ── UPLOAD ZONE ─────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 10px;
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  background: var(--gray-100);
  transition: all 0.2s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--red);
  background: var(--red-bg);
}
.upload-icon { font-size: 28px; margin-bottom: 6px; }
.upload-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.upload-sub { font-size: 11px; color: var(--gray-500); }

.file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 7px;
}
.file-chip-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip-size { font-size: 10px; color: var(--gray-400); }
.file-chip-rm {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
.file-chip-rm:hover { color: var(--red); }

/* ── TYPE BUTTONS (account type / period) ── */
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.type-btn {
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 13px 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
  font-family: inherit;
}
.type-btn .sub {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--gray-600);
  margin-top: 3px;
}
.type-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}
.type-btn.active {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
  font-weight: 700;
}
.type-btn.active .sub { color: var(--red-light); }

/* ── INPUTS ──────────────────────────────── */
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.input-group { margin-bottom: 14px; }
.input-label {
  font-size: 11px;
  color: var(--text-soft);
  margin-bottom: 5px;
  display: block;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.input-field {
  width: 100%;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-weight: 500;
}
.input-field:focus {
  border-color: var(--red);
  background: var(--white);
}
.input-field::placeholder { color: var(--gray-400); font-weight: 400; }

.prefix-wrap { position: relative; }
.prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}
.prefix-wrap .input-field { padding-left: 26px; }

.suffix { color: var(--gray-500); font-size: 12px; margin-left: 6px; }

select.input-field {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23C0111F' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.hint {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 5px;
  font-style: italic;
}

/* ── SWITCH (toggle manual mode) ─────────── */
.switch-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: 10px;
  margin-bottom: 12px;
}
.switch-card-text { flex: 1; }
.switch-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
}
.switch-card-sub {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider { background: var(--red); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* ── MANUAL ROWS ─────────────────────────── */
.manual-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.manual-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 32px;
  gap: 8px;
  align-items: center;
}
.manual-row .input-field { padding: 8px 10px; font-size: 13px; }
.manual-rm {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-400);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.manual-rm:hover { color: var(--red); border-color: var(--red); }
.manual-add {
  margin-top: 8px;
  background: transparent;
  border: 1.5px dashed var(--gray-300);
  border-radius: 8px;
  padding: 8px;
  color: var(--gray-600);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}
.manual-add:hover { border-color: var(--red); color: var(--red); }

/* ── CALCULATE BUTTON ────────────────────── */
.calc-btn {
  width: 100%;
  background: var(--red);
  border: none;
  border-radius: 10px;
  padding: 15px;
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.3px;
  margin-top: 4px;
}
.calc-btn:hover:not(:disabled)  { opacity: 0.88; }
.calc-btn:active:not(:disabled) { transform: scale(0.98); }
.calc-btn:disabled {
  background: var(--gray-300);
  color: var(--gray-500);
  cursor: not-allowed;
}

/* ── LOADING ─────────────────────────────── */
.loading {
  display: none;
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--gray-600);
}
.loading.show { display: block; }
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ERROR ───────────────────────────────── */
.err-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 12px;
  color: #991b1b;
  margin-bottom: 12px;
}

/* ── RESULT CARD ─────────────────────────── */
.result-card {
  background: var(--red-bg);
  border: 1.5px solid var(--red-border);
  border-radius: 12px;
  padding: 22px;
  margin-top: 12px;
  display: none;
  animation: fadeIn 0.3s ease;
}
.result-card.show { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.result-lbl {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 4px;
  font-weight: 700;
}
.result-amount {
  font-size: 38px;
  color: var(--red);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}
.result-meta {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.status-green  { background: var(--green-bg); color: var(--green);  border: 1px solid var(--green);  }
.status-yellow { background: var(--amber-bg); color: var(--amber);  border: 1px solid var(--amber);  }
.status-red    { background: #fef2f2;         color: #991b1b;        border: 1px solid var(--red);    }

/* ── BREAKDOWN ───────────────────────────── */
.breakdown {
  margin-top: 16px;
  border-top: 1px solid var(--red-border);
  padding-top: 14px;
}
.brow {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
}
.brow .bk { color: var(--text-soft); font-weight: 400; }
.brow .bv { color: var(--text);      font-weight: 600; }
.brow.total {
  border-top: 1px solid var(--red-border);
  margin-top: 6px;
  padding-top: 10px;
}
.brow.total .bk { color: var(--red); font-weight: 700; }
.brow.total .bv { color: var(--red); font-weight: 800; }

/* ── MONTHLY TABLE ───────────────────────── */
.month-table-wrap {
  margin-top: 14px;
  background: var(--white);
  border: 1px solid var(--red-border);
  border-radius: 9px;
  overflow: hidden;
}
.month-table-title {
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px;
}
.month-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.month-table th, .month-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--gray-200);
}
.month-table th {
  background: var(--gray-100);
  color: var(--text-soft);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.month-table th:first-child, .month-table td:first-child {
  text-align: left;
}
.month-table tr:last-child td { border-bottom: none; }
.month-table tfoot td {
  background: var(--red-bg);
  font-weight: 700;
  color: var(--red);
  border-top: 2px solid var(--red);
}

/* ── ALERTS ──────────────────────────────── */
.alerts-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert {
  display: flex;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid;
}
.alert-ok    { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.alert-info  { background: #eff6ff;        border-color: #93c5fd;       color: #1e40af; }
.alert-warn  { background: var(--amber-bg); border-color: #fcd34d;      color: var(--amber); }
.alert-error { background: #fef2f2;        border-color: #fca5a5;       color: #991b1b; }
.alert-ico { flex-shrink: 0; font-weight: 700; }

/* ── LARGE DEPOSITS ──────────────────────── */
.lg-deposits {
  margin-top: 14px;
  background: var(--white);
  border: 1px solid var(--amber);
  border-radius: 9px;
  padding: 12px 14px;
}
.lg-deposits-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.lg-deposit-row {
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--gray-200);
}
.lg-deposit-row:last-child { border-bottom: none; }

/* ── CONCLUSION ──────────────────────────── */
.conclusion {
  margin-top: 14px;
  background: var(--white);
  border: 1px solid var(--red-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}
.conclusion strong { color: var(--red); }

/* ── RESET BUTTON ────────────────────────── */
.reset-btn {
  width: 100%;
  background: transparent;
  border: 1.5px solid var(--gray-200);
  border-radius: 9px;
  padding: 11px;
  color: var(--gray-600);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.2s;
}
.reset-btn:hover { border-color: var(--red); color: var(--red); }

/* ── UTILS ───────────────────────────────── */
.hidden { display: none !important; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 520px) {
  .input-row { grid-template-columns: 1fr; }
  .result-amount { font-size: 32px; }
  .month-table { font-size: 11px; }
  .month-table th, .month-table td { padding: 6px 7px; }
}
