/* Kornzaft Budget — design system
   Paper & ink: fondo calido casi blanco, tinta casi negra, un acento teal.
   Bordes hairline en vez de sombras; Inter; espaciado generoso. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #78716c;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #f0fdfa;
  --accent-mid: #99f6e4;
  --pos: #047857;
  --neg: #dc2626;
  --warn: #d97706;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

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

/* El atributo hidden debe ganar siempre — las reglas display:flex/grid
   de los componentes lo pisarian (estilos de autor > estilos del UA). */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.6;
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11";
}

img {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--ink);
  color: var(--surface);
}

.btn-primary:hover {
  background: var(--ink-soft);
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  border-color: var(--ink);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13.5px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo:hover {
  text-decoration: none;
}

.logo .logo-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.logo span em {
  font-style: normal;
  color: var(--accent);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.main-nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.main-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--ink);
}

/* ---------- Hero ---------- */
.hero {
  background: var(--bg);
  padding: 96px 0 72px;
  border-bottom: 1px solid var(--border);
}

.hero .container {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 18px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p.lead {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 32px;
  max-width: 480px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-art {
  text-align: center;
}

/* ---------- Sections ---------- */
section {
  padding: 88px 0;
}

section.alt {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-sub {
  text-align: center;
  font-size: 16px;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 56px;
}

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: left;
}

.feature-card .icon {
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 14px;
  color: var(--muted);
}

/* ---------- How it works ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.step {
  text-align: left;
  padding: 28px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step .step-num {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.step h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.step p {
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Download ---------- */
.download-badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
}

.badge:hover {
  border-color: var(--ink);
  text-decoration: none;
}

.badge small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

/* ---------- Courses / cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.course-card .card-head {
  background: var(--accent-soft);
  color: var(--ink);
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.course-card .card-head .code {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.course-card .card-head h3 {
  font-size: 19px;
  font-weight: 700;
  margin-top: 4px;
}

.course-card .card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-card .card-body p {
  color: var(--muted);
  font-size: 14px;
  flex: 1;
}

.course-card .meta {
  display: flex;
  gap: 8px;
  margin: 18px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.course-card .meta span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
}

/* ---------- Press / testimonials ---------- */
.press-row {
  display: flex;
  justify-content: center;
  gap: 44px;
  flex-wrap: wrap;
  font-size: 17px;
  font-weight: 700;
  color: var(--border-strong);
  letter-spacing: -0.01em;
}

.testimonial {
  max-width: 640px;
  margin: 48px auto 0;
  text-align: center;
}

.testimonial blockquote {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.testimonial cite {
  display: block;
  margin-top: 14px;
  font-style: normal;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}

.price-card.premium {
  border-color: var(--ink);
}

.price-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.price-card .price {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 10px 0 2px;
  font-variant-numeric: tabular-nums;
}

.price-card .per {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.price-card ul {
  list-style: none;
  margin-bottom: 26px;
}

.price-card ul li {
  padding: 6px 0 6px 26px;
  position: relative;
  font-size: 14px;
  color: var(--ink-soft);
}

.price-card ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--ink);
  color: var(--surface);
  text-align: center;
  padding: 72px 0;
}

.cta-band h2 {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 22px;
}

.cta-band .btn {
  background: var(--surface);
  color: var(--ink);
}

.cta-band .btn:hover {
  background: var(--bg);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  color: var(--muted);
  padding: 56px 0 32px;
  font-size: 14px;
  border-top: 1px solid var(--border);
}

.footer-cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}

.site-footer h4 {
  color: var(--ink);
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
}

.site-footer ul {
  list-style: none;
}

.site-footer ul li {
  margin-bottom: 9px;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--ink);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- App (dashboard) ---------- */
.app-body {
  background: var(--bg);
  min-height: 100vh;
}

.app-header-bar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.app-header-bar .logo {
  color: var(--ink);
  font-size: 16px;
}

.app-header-bar a.back,
.app-header-bar .back {
  color: var(--muted);
  font-size: 13px;
}

/* stats */
.stats-row {
  max-width: 1100px;
  margin: 28px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.app-layout {
  max-width: 1100px;
  margin: 20px auto 48px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.panel h2 .total {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* envelope rows */
.envelope {
  padding: 11px 0;
  border-bottom: 1px solid var(--bg);
}

.envelope:last-child {
  border-bottom: none;
}

.envelope .env-top {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 7px;
  gap: 12px;
}

.envelope .env-top .amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount.neg {
  color: var(--neg);
}

.amount.pos {
  color: var(--pos);
}

.bar {
  height: 5px;
  border-radius: 999px;
  background: #f0efed;
  overflow: hidden;
}

.bar .fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s;
}

.bar .fill.warn {
  background: var(--warn);
}

.bar .fill.over {
  background: var(--neg);
}

.env-budget {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

/* accounts */
.account-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 500;
  border-bottom: 1px solid var(--bg);
  gap: 12px;
}

.account-row .amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.account-row:last-child {
  border-bottom: none;
}

/* transactions table */
.tx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tx-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.tx-table td {
  padding: 10px;
  border-bottom: 1px solid var(--bg);
  vertical-align: top;
}

.tx-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.tx-table .tx-del {
  background: none;
  border: none;
  color: var(--border-strong);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px;
}

.tx-table .tx-del:hover {
  color: var(--neg);
}

/* forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--ink-soft);
}

input,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* segmented control */
.tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.tabs button {
  flex: 1;
  padding: 7px 6px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.tabs button.active {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.empty-note {
  text-align: center;
  color: var(--muted);
  padding: 18px 0;
  font-size: 13.5px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero .container,
  .app-layout {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

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

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

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .footer-cols {
    grid-template-columns: 1fr 1fr;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .hero h1 {
    font-size: 38px;
  }
}

/* ---------- Modal de edicion ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 9vh 16px;
  z-index: 200;
}

.modal {
  width: 100%;
  max-width: 460px;
  margin: 0;
  max-height: 82vh;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.modal-actions .btn-danger {
  margin-right: auto;
}

.btn-danger {
  background: var(--surface);
  color: var(--neg);
  border-color: var(--neg);
}

.btn-danger:hover {
  background: #fef2f2;
}

/* ---------- Filas clickeables ---------- */
.clickable {
  cursor: pointer;
}

.tx-table tbody tr.clickable:hover td {
  background: var(--bg);
}

.envelope.clickable:hover,
.account-row.clickable:hover {
  background: var(--bg);
}

/* ---------- Lista scrolleable (75 sobres) ---------- */
.scroll-list {
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ---------- Busqueda en historial ---------- */
.panel-tools {
  margin-bottom: 14px;
}

/* ---------- Toasts ---------- */
#toast-container {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.18s ease-out;
  max-width: 90vw;
}

.toast.error {
  background: var(--neg);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Tabla en mobile ---------- */
@media (max-width: 640px) {
  .tx-table th:nth-child(3),
  .tx-table td:nth-child(3),
  .tx-table th:nth-child(4),
  .tx-table td:nth-child(4) {
    display: none;
  }
}
