/* Hipocasa — estilos de la calculadora de crédito hipotecario */
  :root {
    --bg: #f2f5f9;
    --card: #ffffff;
    --ink: #17222e;
    --muted: #5b6b7b;
    --line: #e3e9f0;
    --accent: #0e7c66;
    --accent-dark: #0a5c4c;
    --blue: #1f6feb;
    --warn: #b45309;
    --danger: #c2410c;
    --radius: 14px;
    --input-h: 45px;
    --shadow: 0 1px 3px rgba(23,34,46,.08), 0 8px 24px rgba(23,34,46,.06);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
  }
  header {
    background: linear-gradient(135deg, #0a5c4c 0%, #0e7c66 55%, #128a74 100%);
    color: #fff;
    padding: 28px 20px 68px;
  }
  header .wrap { max-width: 1220px; margin: 0 auto; }
  header h1 { margin: 0 0 6px; font-size: clamp(21px, 3.5vw, 26px); letter-spacing: -.02em; }
  header p { margin: 0; opacity: .85; font-size: 14px; max-width: 760px; }

  main { max-width: 1220px; margin: -44px auto 40px; padding: 0 20px; }

  .layout {
    display: grid;
    grid-template-columns: 460px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
  }
  @media (max-width: 1120px) { .layout { grid-template-columns: minmax(0, 1fr); } }

  .card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
  }

  h2 {
    margin: 0 0 4px;
    font-size: 17px;
    letter-spacing: -.01em;
  }
  .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

  .field { margin-bottom: 16px; }
  .field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
  }
  .field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
  .field input, .field select {
    width: 100%;
    height: var(--input-h);
    padding: 0 13px;
    font-size: 15px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background-color: #fbfcfe;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
  }
  .field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6b7b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
  }
  .field input[type=number] {
    appearance: textfield;
    -moz-appearance: textfield;
  }
  .field input[type=number]::-webkit-outer-spin-button,
  .field input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  .field input:focus, .field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,124,102,.12);
    background-color: #fff;
  }
  .field input:disabled { opacity: .5; cursor: not-allowed; }
  .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  @media (max-width: 660px) {
    .row2 { grid-template-columns: 1fr; gap: 0; }
  }

  .divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 18px 0;
  }
  .section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--accent-dark);
    margin: 0 0 12px;
  }

  .banner {
    display: none;
    border-radius: 12px;
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    border: 1px solid transparent;
  }
  .banner.visible { display: block; }
  .banner.ok { background: #e2f5ef; color: #0a5c4c; border-color: #bfe5da; }
  .banner.info { background: #e8f0fe; color: #1a4fa8; border-color: #c7dbfb; }
  .banner.warn { background: #fdf1e2; color: var(--warn); border-color: #f5dcb8; }

  .cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
  }
  .mini {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
  }
  .mini .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .mini .value { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
  .mini .extra { font-size: 12px; color: var(--muted); margin-top: 3px; }
  .mini.destacada { background: linear-gradient(135deg, #0e7c66, #128a74); color: #fff; }
  .mini.destacada .label { color: rgba(255,255,255,.85); }
  .mini.destacada .extra { color: rgba(255,255,255,.8); }

  .badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
  }
  .badge.ok { background: #e2f5ef; color: #0a5c4c; }
  .badge.no { background: #fdeee2; color: var(--danger); }

  .chart-card { margin-bottom: 20px; }
  .chart-wrap { position: relative; }
  #grafico { width: 100%; height: 320px; display: block; }
  .leyenda { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--muted); }
  .leyenda span { display: inline-flex; align-items: center; gap: 7px; }
  .punto { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
  #tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(23,34,46,.94);
    color: #fff;
    font-size: 12px;
    padding: 8px 11px;
    border-radius: 8px;
    display: none;
    z-index: 5;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
  }
  #tooltip b { display: block; margin-bottom: 3px; }

  .table-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  button {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    transition: background .15s, border-color .15s;
  }
  button:hover { background: #f2f7f5; border-color: #cfd9e3; }
  button.primario { background: var(--accent); border-color: var(--accent); color: #fff; }
  button.primario:hover { background: var(--accent-dark); }
  button:disabled { opacity: .7; cursor: wait; }

  .btn-icono {
    display: inline-flex;
    align-items: center;
    gap: 7px;
  }
  .btn-icono svg {
    width: 15px;
    height: 15px;
  }

  .table-scroll { max-height: 480px; overflow: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; }
  table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 13px; }
  thead th {
    position: sticky;
    top: 0;
    background: #f7fafc;
    text-align: right;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    z-index: 1;
  }
  thead th:first-child, tbody td:first-child { text-align: left; }
  tbody td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid #eef2f6;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  tbody tr:hover td { background: #f6faf9; }
  table.sin-seguro th:nth-child(3), table.sin-seguro td:nth-child(3) { display: none; }
  table.sin-uvas th:nth-child(6), table.sin-uvas td:nth-child(6) { display: none; }
  table.sin-hoy th:nth-child(7), table.sin-hoy td:nth-child(7) { display: none; }
  .field input[type=range] {
    width: 100%;
    height: 24px;
    margin: 10px 0 0;
    padding: 0;
    border: none;
    background: transparent;
    accent-color: var(--accent);
    cursor: pointer;
  }
  .field input[type=range]:focus { box-shadow: none; }
  #btnCredito25 { margin-top: 8px; }
  .veredicto {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
  }
  .veredicto .check {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .veredicto .estado {
    font-size: 15px;
    font-weight: 700;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
  }
  .veredicto .ok .estado { background: #e2f5ef; color: #0a5c4c; }
  .veredicto .no .estado { background: #fdeee2; color: var(--danger); }
  .veredicto .neutral .estado { background: #eef2f6; color: var(--muted); }
  .veredicto .titulo { display: block; font-size: 13px; font-weight: 600; }
  .veredicto .detalle { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

  .error {
    display: none;
    background: #fdeee2;
    color: var(--danger);
    border: 1px solid #f6cdb2;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 16px;
  }
  .error.visible { display: block; }

  footer {
    max-width: 1220px;
    margin: 0 auto 30px;
    padding: 0 20px;
    color: var(--muted);
    font-size: 12.5px;
  }
  footer p { margin: 0 0 6px; }

  @media (max-width: 660px) {
    header { padding: 22px 16px 60px; }
    main { margin-top: -36px; padding: 0 12px; }
    .card { padding: 18px; }
    .mini { padding: 14px 16px; }
    .mini .value { font-size: 19px; }
    #grafico { height: 250px; }
    .field input, .field select { font-size: 16px; }
    .table-head { flex-direction: column; align-items: stretch; }
    .table-head > div:last-child button { flex: 1; }
    .table-scroll { max-height: 380px; }
    footer { padding: 0 12px; }
    .veredicto { grid-template-columns: 1fr; }
  }
