@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Paleta Acrecer (verificada desde acrecer.com: favicon + estilos computados) */
  --brand-teal:       #005d83;
  --brand-teal-dark:  #00435c;
  --brand-teal-light: #3e86a6;
  --brand-lime:       #b4bd00;
  --brand-lime-dark:  #8c9400;
  --white:        #ffffff;

  --gray-50:  #f7f7f8;
  --gray-100: #f0f1f2;
  --gray-200: #e3e5e7;
  --gray-300: #cfd2d6;
  --gray-400: #a3a8ad;
  --gray-500: #767c82;
  --gray-600: #52585e;
  --gray-700: #383d42;
  --gray-800: #232629;
  --gray-900: #17181a;

  --success:       #1f8a4c;
  --success-light: #e5f5ea;
  --danger:        #c0392b;
  --danger-light:  #fbeae8;
  --warning:       #b5790a;
  --warning-light: #fbf1de;

  --radius: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 20px -6px rgba(0,0,0,.15);

  --header-h: 60px;
  --sidebar-w: 230px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
}

/* ── HEADER ── */
#app-header {
  height: var(--header-h);
  background: var(--brand-teal);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  border-bottom: 3px solid var(--brand-lime);
}
.brand { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.nav-logo { height: 32px; width: auto; display: block; }

.app-tabs { display: flex; gap: .35rem; flex: 1; overflow-x: auto; }
.module-tab {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255,255,255,.75);
  padding: .5rem .9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.module-tab:hover { background: rgba(255,255,255,.08); color: #fff; }
.module-tab.active {
  background: #fff;
  color: var(--brand-teal);
  font-weight: 600;
}

.header-right { display: flex; align-items: center; gap: .75rem; }
.user-chip {
  font-size: .8rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  padding: .3rem .7rem;
  border-radius: 999px;
}

/* ── LAYOUT ── */
.app-body { display: flex; min-height: calc(100vh - var(--header-h)); }

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  padding: 1.25rem 0;
}
.sidebar-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  padding: 0 1.25rem 1rem;
}
.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar-item {
  text-align: left;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  padding: .6rem 1.1rem;
  font-size: .88rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: background .15s;
}
.sidebar-item:hover { background: var(--gray-50); }
.sidebar-item.active {
  background: var(--gray-100);
  border-left-color: var(--brand-teal);
  font-weight: 600;
  color: var(--brand-teal);
}

#main { flex: 1; min-width: 0; padding: 1.5rem 2rem 3rem; }
.breadcrumb {
  font-size: .78rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

/* ── KPI CARDS ── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: .82rem; color: var(--gray-500); margin-top: .3rem; }
.kpi-sublabel { font-size: .75rem; color: var(--gray-400); margin-top: .15rem; }
.kpi-card.tone-success .kpi-value { color: var(--success); }
.kpi-card.tone-danger  .kpi-value { color: var(--danger); }
.kpi-card.tone-warning .kpi-value { color: var(--warning); }

/* ── GRID / PANELS ── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel-wide { grid-column: 1 / -1; }
.panel h3 { font-size: .95rem; font-weight: 600; margin-bottom: 1rem; }

/* ── RANKING ── */
.ranking-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: .88rem;
}
.ranking-row:last-child { border-bottom: none; }
.ranking-pos { font-weight: 700; color: var(--gray-400); width: 1.8rem; }
.ranking-name { flex: 1; }
.ranking-badge {
  background: var(--gray-100); border-radius: 999px;
  padding: .2rem .6rem; font-weight: 600; font-size: .8rem;
}

/* ── TABLE ── */
.table-wrap { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem; border-bottom: 1px solid var(--gray-200); gap: 1rem;
}
.table-search {
  border: 1px solid var(--gray-300); border-radius: 6px;
  padding: .45rem .7rem; font-size: .85rem; width: 240px; max-width: 100%;
}
.table-search:focus { outline: none; border-color: var(--brand-teal); }
.table-count { font-size: .78rem; color: var(--gray-500); white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th {
  text-align: left; padding: .65rem 1rem; background: var(--gray-50);
  color: var(--gray-600); font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .03em; cursor: pointer; white-space: nowrap;
  border-bottom: 1px solid var(--gray-200);
}
.data-table th:hover { color: var(--brand-teal); }
.data-table td { padding: .65rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; color: var(--gray-400); padding: 1.5rem !important; }
.table-pagination {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: .75rem; border-top: 1px solid var(--gray-200); font-size: .82rem; color: var(--gray-600);
}
.btn-page {
  background: #fff; border: 1px solid var(--gray-300); border-radius: 6px;
  padding: .35rem .75rem; cursor: pointer; font-size: .8rem;
}
.btn-page:disabled { opacity: .4; cursor: not-allowed; }
.btn-page:not(:disabled):hover { background: var(--gray-100); }

/* ── BADGES ── */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-muted   { background: var(--gray-100); color: var(--gray-500); }
.badge-neutral { background: var(--gray-100); color: var(--gray-700); }

/* ── PROFILE / SEDE CARD ── */
.profile-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
}
.profile-header { display: flex; align-items: center; gap: 1rem; }
.profile-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand-teal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.profile-header h2 { font-size: 1.15rem; }
.profile-header p { color: var(--gray-500); font-size: .85rem; margin-top: .1rem; }
.profile-header .badge { margin-left: auto; }
.profile-meta { display: flex; gap: 2.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }
.profile-meta > div { display: flex; flex-direction: column; gap: .2rem; }
.meta-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-400); }

.list-toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }

.detail-list { display: flex; flex-direction: column; gap: .55rem; }
.detail-list > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .86rem; border-bottom: 1px solid var(--gray-100); padding-bottom: .55rem; }
.detail-list > div:last-child { border-bottom: none; padding-bottom: 0; }
.detail-list dt { color: var(--gray-500); }
.detail-list dd { font-weight: 500; text-align: right; }

.sedes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.sede-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem;
}
.sede-card h3 { margin-bottom: .4rem; }
.sede-card p { font-size: .85rem; color: var(--gray-600); margin-bottom: .2rem; }
.sede-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }

/* ── FORMS ── */
.form-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 1.5rem; max-width: 520px; display: flex; flex-direction: column; gap: 1rem;
}
.form-row { display: flex; flex-direction: column; gap: .35rem; }
.form-row label { font-size: .8rem; font-weight: 600; color: var(--gray-700); }
.form-row input, .form-row select, .form-row textarea {
  border: 1px solid var(--gray-300); border-radius: 6px; padding: .55rem .7rem; font-size: .88rem; font-family: inherit;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--brand-teal); }
.form-actions { display: flex; gap: .75rem; }
.form-hint { font-size: .82rem; color: var(--gray-500); min-height: 1.2em; }
.form-hint-success { color: var(--success); font-weight: 600; }

.btn-primary {
  background: var(--brand-teal); color: #fff; border: none; border-radius: 6px;
  padding: .6rem 1.1rem; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--brand-teal-dark); }
.btn-link {
  background: transparent; border: none; color: var(--brand-teal);
  font-weight: 600; font-size: .82rem; cursor: pointer; text-decoration: underline;
}

.empty-hint { color: var(--gray-500); font-size: .88rem; padding: 1rem 0; }

@media (max-width: 860px) {
  .app-body { flex-direction: column; }
  #sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--gray-200); padding: .5rem 0; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 0 .5rem; }
  .sidebar-item { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .sidebar-item.active { border-left-color: transparent; border-bottom-color: var(--brand-teal); }
  #main { padding: 1.25rem 1rem 2rem; }
}
