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

* { 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;
}

header.topnav {
  background: white;
  color: var(--text);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  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; }
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; } }

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; }

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

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-tile { background: white; border-radius: var(--card-radius); box-shadow: 0 2px 10px rgba(0,17,57,0.08); padding: 14px 16px; border-left: 4px solid var(--teal-primary); }
.kpi-tile.good { border-left-color: var(--good); }
.kpi-tile.warn { border-left-color: var(--warn); }
.kpi-tile .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.kpi-tile .value { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-card { background: white; border-radius: var(--card-radius); box-shadow: 0 2px 10px rgba(0,17,57,0.08); padding: 16px 18px; }
.dash-card h4 { margin: 0 0 12px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dash-gauges { display: flex; justify-content: space-around; align-items: flex-start; }

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

.page-intro { font-size: 14px; color: #4a5a61; margin: -8px 0 8px; max-width: 640px; }

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

.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, textarea { width: 100%; padding: 9px; border: 1.5px solid #d5dde0; border-radius: 6px; font-size: 14px; font-family: inherit; background: white; }
textarea { resize: vertical; }

.back-link { display: inline-block; margin-top: 4px; color: var(--teal-primary); text-decoration: none; font-size: 14px; }

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; }

.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; }
}

/* ---------------- Home: hero + feed + accesos rapidos ---------------- */

.hero { margin-bottom: 6px; }
.hero .greet { font-size: 22px; font-family: Arial, Helvetica, sans-serif; font-weight: 700; color: var(--navy); }
.hero .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.stat-row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.stat-chip {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-width: 150px;
}
.stat-chip .ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-chip .num { font-weight: 700; font-size: 17px; color: var(--navy); line-height: 1.1; }
.stat-chip .lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* align-items:stretch (default) a proposito -- las dos columnas del grid
   estiran a la misma altura; si no, cuando "Tus pendientes"+"Cumpleanos"+
   "Accesos" suman mas alto que Noticias, la columna izquierda se queda
   corta y deja un hueco vacio de fondo de pagina en vez de que la tarjeta
   blanca de Noticias llegue hasta abajo (bug real reportado por Carlos,
   captura del 2026-08-04). */
.home-layout { display: grid; grid-template-columns: 1.9fr 1.1fr; gap: 20px; margin-top: 20px; align-items: stretch; }
@media (max-width: 900px) { .home-layout { grid-template-columns: 1fr; } }
.col-main { display: flex; flex-direction: column; }
.col-main .feed-card { flex: 1; display: flex; flex-direction: column; }

.card-head { padding: 2px 2px 12px; display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { margin: 0; border: none; padding: 0; font-size: 15px; }
.card-head .tag { font-size: 10.5px; color: var(--muted); font-weight: normal; }

.feed-card { padding: 4px 0 6px; }
.post { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 12px; }
.post:first-of-type { border-top: none; }
.post .pav { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: white; }
.post .body { flex: 1; min-width: 0; }
.post .meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.post .meta b { color: var(--text); }
.post .txt { font-size: 13.5px; line-height: 1.45; }
.post .txt .hl { color: var(--teal-primary); font-weight: 700; }
.feed-empty { padding: 24px 18px; text-align: center; color: var(--muted); font-size: 13px; }

.area-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 2px 6px; font-weight: 700; }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 4px; }
.qa-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  display: flex; flex-direction: column; gap: 7px; text-decoration: none; color: var(--text);
  transition: border-color 0.15s;
}
.qa-item:hover { border-color: var(--teal-secondary); }
.qa-item.proximamente { opacity: 0.55; cursor: default; }
.qa-item .ico { width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: white; }
.qa-item .lbl { font-size: 11.5px; font-weight: 700; color: var(--text); line-height: 1.2; }

.bday-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.bday-row .avatar { width: 30px; height: 30px; }
.bday-row .txt { font-size: 12.5px; }
.bday-row .txt b { display: block; font-size: 12.5px; }
.bday-row .when { margin-left: auto; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bday-empty { padding: 10px 2px; color: var(--muted); font-size: 12.5px; }

.pend-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--line); }
.pend-row:first-child { border-top: none; }
.pend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.pend-txt { font-size: 12.5px; flex: 1; }
.pend-txt .sub { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.pend-empty { padding: 10px 2px; color: var(--muted); font-size: 12.5px; }

/* ---------------- Barra de busqueda (Directorio, Documentos) ---------------- */

.search-bar {
  display: flex; align-items: center; gap: 10px; background: white; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 18px;
}
.search-bar svg.icon { color: var(--muted); flex-shrink: 0; }
.search-bar input { border: none; padding: 4px 0; flex: 1; font-size: 14px; }
.search-bar input:focus { outline: none; }

/* ---------------- Directorio: tarjetas de persona ---------------- */

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person-card {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start;
}
.person-card .p-info { min-width: 0; flex: 1; }
.person-card .p-name { font-weight: 700; color: var(--navy); font-size: 14px; }
.person-card .p-role { font-size: 12px; color: var(--muted); margin-top: 1px; }
.person-card .p-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.p-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text);
  background: var(--bg); border-radius: 999px; padding: 4px 9px; text-decoration: none;
}
.p-chip svg.icon { width: 12px; height: 12px; color: var(--muted); }
a.p-chip:hover { background: var(--teal-secondary); color: white; }
a.p-chip:hover svg.icon { color: white; }

/* ---------------- Documentos: mapa visual por area ---------------- */

.area-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.area-card {
  background: white; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 12px;
  text-decoration: none; color: var(--text); text-align: center; transition: border-color 0.15s, transform 0.1s;
}
.area-card:hover { border-color: var(--teal-secondary); transform: translateY(-2px); }
.area-card.active { border-color: var(--teal-primary); background: rgba(25,142,160,0.06); }
.area-card .ico {
  width: 38px; height: 38px; border-radius: 10px; background: rgba(25,142,160,0.1); color: var(--teal-primary);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 8px;
}
.area-card.active .ico { background: var(--teal-primary); color: white; }
.area-card .ico svg.icon { width: 18px; height: 18px; }
.area-card .a-name { font-size: 12px; font-weight: 700; color: var(--navy); line-height: 1.25; min-height: 30px; display: flex; align-items: center; justify-content: center; }
.area-card .a-count { font-size: 19px; font-weight: 700; color: var(--teal-primary); margin-top: 2px; font-family: Arial, Helvetica, sans-serif; }
