* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  background: #f4f6fa; color: #1a1a1a;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
header {
  background: #0b5394; color: white;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
header h1 { margin: 0; font-size: 20px; font-weight: 600; }
#reload {
  background: rgba(255,255,255,0.2); border: none; color: white;
  font-size: 22px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
}
#reload:active { background: rgba(255,255,255,0.35); }

nav#tabs {
  display: flex; overflow-x: auto; background: white;
  border-bottom: 1px solid #e0e4ec; position: sticky; top: 65px; z-index: 9;
}
nav#tabs button {
  flex-shrink: 0; padding: 14px 18px; border: none; background: transparent;
  color: #555; font-size: 15px; cursor: pointer; border-bottom: 3px solid transparent;
}
nav#tabs button.active { color: #0b5394; border-bottom-color: #0b5394; font-weight: 600; }

main { padding: 16px; max-width: 900px; margin: 0 auto; }

.tab { display: none; }
.tab.active { display: block; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card { background: white; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card h3 { margin: 0 0 6px; font-size: 13px; color: #6b7280; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.card .v { font-size: 22px; font-weight: 700; color: #0b5394; }
.card .sub { font-size: 12px; color: #888; margin-top: 4px; }

h2 { font-size: 18px; margin: 24px 0 12px; color: #333; }

.lista { display: flex; flex-direction: column; gap: 8px; }
.item {
  background: white; border-radius: 10px; padding: 14px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.item .left { flex: 1; min-width: 0; }
.item .titulo { font-weight: 600; font-size: 15px; }
.item .sub { font-size: 13px; color: #777; margin-top: 3px; }
.item .right { text-align: right; }
.item .total { font-weight: 700; color: #0b5394; }
.item .pdf {
  display: inline-block; margin-top: 4px; padding: 4px 8px; font-size: 12px;
  background: #eef3fa; color: #0b5394; border-radius: 6px; text-decoration: none;
}

table.trim { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; }
table.trim th, table.trim td { padding: 10px; text-align: right; font-size: 13px; border-bottom: 1px solid #eef0f5; }
table.trim th:first-child, table.trim td:first-child { text-align: left; }
table.trim th { background: #f4f6fa; color: #555; font-weight: 600; font-size: 12px; text-transform: uppercase; }

.enlace { display: block; background: white; border-radius: 12px; padding: 16px; margin-bottom: 10px; color: #0b5394; text-decoration: none; }
.enlace strong { display: block; font-size: 15px; color: #1a1a1a; }
.enlace small { color: #777; }

.vacio { text-align: center; color: #888; padding: 40px 16px; }

#loader { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: white; padding: 10px 20px; border-radius: 24px; font-size: 13px; }
.hidden { display: none !important; }
