:root {
  --bg: #f8fafc;
  --surface: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe3ea;
  --teal: #0f766e;
  --green: #16a34a;
  --blue: #2563eb;
  --violet: #6d5bd0;
  --amber: #d97706;
  --danger: #dc2626;
  --shadow: 0 14px 32px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 170px 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  border-right: 1px solid var(--border);
  height: 46px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid var(--teal);
  border-radius: 8px;
  color: var(--teal);
  font-weight: 800;
}
.brand-text { font-weight: 800; font-size: 14px; line-height: 1.1; }
.title-block { display: flex; align-items: baseline; gap: 20px; }
h1 { margin: 0; font-size: 30px; line-height: 1; letter-spacing: 0; }
.title-block p { margin: 0; color: var(--muted); font-size: 14px; }
.download-button, .admin-link {
  border: 1px solid var(--teal);
  color: var(--teal);
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 800;
}
.admin-link { border-color: var(--border); color: var(--muted); }

.shell { max-width: 1520px; margin: 0 auto; padding: 16px 20px 32px; }
.kpi-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi {
  min-height: 96px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 18px 20px;
  box-shadow: 0 8px 20px rgba(15,23,42,.04);
}
.kpi span { display: block; font-size: 14px; color: var(--text); }
.kpi strong { display: block; margin-top: 8px; font-size: 32px; line-height: 1; }
.kpi.teal strong { color: var(--teal); }
.kpi.green strong { color: var(--green); }
.kpi.blue strong { color: var(--blue); }
.kpi.violet strong { color: var(--violet); }
.kpi.amber strong { color: var(--amber); }

.workspace { display: grid; grid-template-columns: 1fr 420px; gap: 14px; }
.map-region, .filters, .table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow);
}
.map-region { min-height: 440px; overflow: hidden; }
#map { min-height: 440px; width: 100%; height: 100%; }
.filters { padding: 18px; }
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.filters h2, .section-head h2 { margin: 0; font-size: 18px; }
.filters-head button {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 800;
  cursor: pointer;
}
.filters label { display: grid; gap: 7px; margin-bottom: 14px; font-size: 13px; font-weight: 800; }
.filters input, .filters select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 10px;
  background: #fff;
}
.check-row { grid-template-columns: 16px 1fr; align-items: center; color: var(--text); }
.apply-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 5px;
  color: #fff;
  background: var(--teal);
  font-weight: 800;
  cursor: pointer;
}

.table-section { margin-top: 16px; overflow: hidden; }
.section-head {
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.section-head span { color: var(--muted); font-weight: 800; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1050px; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e8eef5; text-align: left; font-size: 14px; }
th { color: #334155; background: #f8fafc; font-size: 12px; text-transform: uppercase; }
tr { cursor: pointer; }
tr:hover td { background: #f8fafc; }
.status {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}
.status.en-revision { background: #fef3c7; color: #92400e; }
.status.pendiente { background: #e2e8f0; color: #334155; }
.chip {
  display: inline-flex;
  margin: 3px 4px 0 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}

.profile-dialog {
  width: min(860px, calc(100vw - 28px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .3);
}
.profile-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.profile { padding: 24px; }
.close-button { float: right; border: 0; background: #e2e8f0; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.profile h2 { margin: 0 0 8px; font-size: 26px; }
.profile-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.profile-photo {
  min-height: 210px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
  display: grid;
  place-items: center;
  color: var(--teal);
  font-weight: 900;
  overflow: hidden;
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-section { margin-top: 16px; }
.profile-section h3 { margin: 0 0 8px; font-size: 15px; text-transform: uppercase; color: var(--muted); }
.social-list { display: flex; flex-wrap: wrap; gap: 8px; }
.social-list a { color: var(--teal); font-weight: 800; }

@media (max-width: 980px) {
  .topbar { height: auto; grid-template-columns: 1fr; padding: 16px; }
  .brand { border-right: 0; }
  .title-block { display: block; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shell { padding: 14px; }
  .kpi-strip { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
}
