:root {
  --teal-primary: #198EA0;
  --teal-secondary: #16B8BD;
  --teal-accent: #15E9DD;
  --navy: #001139;
  --text: #1A2E35;
  --bg: #FAF7F2;
  --card-radius: 14px;
  --line: #E7E2D8;
  --muted: #64777C;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0;
  line-height: 1.4;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topnav {
  background: white;
  color: var(--text);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
header.topnav .brand img { height: 30px; display: block; }
header.topnav .navlinks { display: flex; gap: 22px; flex: 1; }
header.topnav .navlinks a { color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 700; opacity: 0.78; display: inline-flex; align-items: center; gap: 5px; }
header.topnav .navlinks a:hover { opacity: 1; color: var(--teal-primary); }
header.topnav .user { font-size: 13px; display: flex; align-items: center; gap: 10px; }
header.topnav .user .nombre { font-weight: 700; color: var(--navy); }
header.topnav .user a { color: var(--muted); text-decoration: none; }
header.topnav .user a:hover { color: var(--teal-primary); text-decoration: underline; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal-secondary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}
svg.icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; }

main { max-width: 1240px; margin: 0 auto; padding: 16px 14px 40px; }
@media (min-width: 640px) { main { padding: 32px 40px 56px; } }

nav.tabs {
  background: white;
  border-bottom: 1px solid #e0e6e8;
  display: flex;
  gap: 4px;
  padding: 0 14px;
  overflow-x: auto;
  box-shadow: 0 1px 4px rgba(0,17,57,0.05);
}
@media (min-width: 640px) { nav.tabs { padding: 0 40px; } }
nav.tabs a {
  display: inline-block;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: bold;
  color: #4a5a61;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
nav.tabs a:hover { color: var(--teal-primary); }
nav.tabs a.activo { color: var(--teal-primary); border-bottom-color: var(--teal-secondary); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.banco-flujo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.banco-flujo-card { background: white; border-radius: var(--card-radius); box-shadow: 0 2px 10px rgba(0,17,57,0.08); padding: 16px; }
.banco-flujo-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 15px; color: var(--navy); }
.stat-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-grid-3 .stat-card { padding: 14px; box-shadow: none; border: 1px solid #e7edf0; }
@media (max-width: 480px) { .stat-grid-3 { grid-template-columns: 1fr; } }
.stat-card {
  background: white; border-radius: var(--card-radius); box-shadow: 0 2px 10px rgba(0,17,57,0.08);
  padding: 20px; text-align: left;
}
.stat-card .label { font-size: 13px; color: #4a5a61; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: bold; color: var(--navy); }
.stat-card .value.small { font-size: 18px; }
.stat-card.warn { border-left: 4px solid #d9822b; }
.stat-card.good { border-left: 4px solid var(--teal-secondary); }
.stat-card .fuente { font-size: 11px; color: #8a9599; margin-top: 8px; }
.stat-card .fuente a { color: #8a9599; }

.aviso-pendiente {
  background: #fff8ec; border: 1px solid #f0d8a8; color: #7a5a1f;
  border-radius: 10px; padding: 14px 16px; font-size: 13px;
}

h1, h2, h3 { font-family: Arial, Helvetica, sans-serif; color: var(--navy); }
h1 { font-size: 26px; margin: 4px 0 22px; }
h2 { font-size: 19px; margin: 4px 0 14px; }
h3 { font-size: 16px; margin: 30px 0 14px; color: var(--teal-primary); border-bottom: 2px solid var(--teal-secondary); padding-bottom: 6px; }

.page-intro { font-size: 14px; color: #4a5a61; margin: -8px 0 8px; max-width: 640px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.card {
  background: white;
  border-radius: var(--card-radius);
  box-shadow: 0 2px 10px rgba(0,17,57,0.08);
  padding: 18px;
  margin-bottom: 16px;
}

.hero-card {
  background: white; border-radius: var(--card-radius); box-shadow: 0 2px 14px rgba(0,17,57,0.10);
  padding: 28px 24px; text-align: center; margin-bottom: 18px;
  border-top: 6px solid var(--teal-secondary);
}
.hero-card.warn { border-top-color: #d9822b; }
.hero-card .hero-label { font-size: 15px; color: #4a5a61; margin-bottom: 6px; }
.hero-card .hero-value { font-size: 48px; font-weight: bold; color: var(--navy); line-height: 1.1; }
.hero-card .hero-sub { font-size: 13px; color: #8a9599; margin-top: 6px; }

.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.dev-card {
  background: white;
  border-radius: var(--card-radius);
  box-shadow: 0 2px 10px rgba(0,17,57,0.08);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: block;
  border-top: 4px solid var(--teal-primary);
  transition: transform 0.15s;
}
.dev-card:hover { transform: translateY(-2px); }
.dev-card.proximamente { border-top-color: #ccc; opacity: 0.7; cursor: default; }
.dev-card h4 { margin: 0 0 6px; font-size: 16px; color: var(--navy); }
.dev-card .tag { font-size: 11px; color: white; background: var(--teal-secondary); padding: 2px 8px; border-radius: 999px; }
.dev-card.proximamente .tag { background: #999; }

.badge { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: bold; color: white; }

.badge-mes { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: bold; margin-left: 8px; vertical-align: middle; }
.badge-mes.cerrado { background: #e2f6ee; color: #1a7a52; border: 1px solid #b9e6d1; }
.badge-mes.estimacion { background: #fff3e0; color: #8a5a12; border: 1px solid #f0d8a8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--teal-primary); color: white; padding: 10px 16px;
  border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: bold;
  text-decoration: none; min-height: 40px;
}
.btn:hover { background: var(--teal-secondary); }
.btn.secondary { background: white; color: var(--teal-primary); border: 1.5px solid var(--teal-primary); }
.btn.small { padding: 7px 12px; font-size: 12px; min-height: 32px; }
.btn.danger { background: #b33636; }
.btn.danger:hover { background: #8f2b2b; }
.btn.icon { width: auto; padding: 8px 11px; font-size: 15px; min-height: 34px; line-height: 1; }

.acciones-cell { display: flex; gap: 6px; align-items: center; }

label { display: block; font-size: 13px; margin: 10px 0 4px; font-weight: bold; color: var(--navy); }
input, select { width: 100%; padding: 9px; border: 1.5px solid #d5dde0; border-radius: 6px; font-size: 14px; font-family: inherit; background: white; }

table.admin { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
table.admin th, table.admin td { border: 1px solid #e0e6e8; padding: 10px 8px; text-align: left; vertical-align: middle; }
table.admin th { background: var(--teal-primary); color: white; font-size: 13.5px; font-weight: 700; letter-spacing: 0.2px; }
table.admin tr:nth-child(even) { background: #f7fafb; }
table.admin tr:hover { background: #eaf6f7; }
table.admin form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
table.admin input { width: auto; min-width: 180px; padding: 6px; font-size: 12px; }
table.admin tr.fila-total { background: #eaf6f7; font-weight: bold; }
table.admin tr.fila-total td { border-top: 2px solid var(--teal-primary); }

.login-box { text-align: center; margin-top: 60px; }
.login-box img { max-width: 220px; margin-bottom: 24px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.inline-form > div { flex: 1; min-width: 140px; }

@media (max-width: 480px) {
  .dev-grid { grid-template-columns: 1fr; }
}
