:root {
  --teal: #0a8a7f;
  --teal-dark: #076b62;
  --teal-light: #e6f4f2;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f7f8;
  --white: #ffffff;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f0f0f0; padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

/* ---- Topbar ---- */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; flex-direction: row; align-items: center; gap: 14px; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand-cenem { display: flex; flex-direction: column; line-height: 1.1; }
.brand-mark { font-weight: 800; font-size: 1.35rem; color: var(--teal); letter-spacing: 0.5px; }
.brand-mark.big { font-size: 2rem; }
.brand-sub { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-logo-repo { height: 40px; }
.brand-divider { width: 1px; height: 34px; background: var(--line); display: inline-block; }
.topnav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topnav a { color: var(--ink); font-size: 0.92rem; }
.topnav a:hover { color: var(--teal); }
.nav-user { color: var(--muted); font-size: 0.88rem; }
.link-btn { background: none; border: none; color: var(--teal); cursor: pointer; font-size: 0.92rem; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---- Layout ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 1.8rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mt { margin-top: 16px; }

/* ---- Panels ---- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 16px; font-size: 1.15rem; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- Forms ---- */
.form label { display: block; margin-bottom: 14px; font-size: 0.9rem; font-weight: 600; }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=url], .form input[type=search], .form input[type=file],
.form select, .form textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 400;
  background: var(--white);
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-light);
}
.form .checkbox { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.form .checkbox input { width: auto; margin: 0; }
.inline-form { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; flex: 1; min-width: 160px; margin-top: 0; }
.inline { display: inline; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; }
.btn-link { color: var(--teal); border-color: transparent; background: transparent; font-weight: 600; }
.btn-link:hover { background: var(--teal-light); text-decoration: none; }
.btn-danger { color: var(--danger); border-color: #f3c9c9; }
.btn-danger:hover { background: #fdecec; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 0.92rem; }
.alert-error { background: #fdecec; color: #a11; border: 1px solid #f3c9c9; }
.alert-ok { background: #e7f6ec; color: #1a7f3c; border: 1px solid #bfe6cc; }

/* ---- Auth ---- */
.auth-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.auth-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-brand { margin-bottom: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.auth-cenem { display: flex; flex-direction: column; align-items: center; }
.auth-logo { max-height: 64px; max-width: 260px; width: auto; display: block; }
.auth-logo-repo { max-height: 56px; max-width: 240px; }
.auth-divider { width: 64px; height: 1px; background: var(--line); }
.auth-title { text-align: center; margin: 6px 0; font-size: 1.4rem; }
.auth-desc { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 0.9rem; }

/* ---- Cards (repos) ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.repo-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); color: var(--ink);
}
.repo-card:hover { border-color: var(--teal); text-decoration: none; transform: translateY(-1px); transition: .12s; }
.repo-card-icon { font-size: 1.8rem; }
.repo-card-body h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--teal); }

/* ---- Documentos (listado tipo CENEM) ---- */
.doc-section { margin-bottom: 28px; }
.section-title {
  color: var(--teal); font-size: 1.05rem; padding-bottom: 10px;
  border-bottom: 2px solid var(--teal-light); margin-bottom: 4px;
}
.doc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 8px; border-bottom: 1px solid var(--line);
}
.doc-row:hover { background: #fafcfc; }
.doc-main { display: flex; gap: 14px; align-items: flex-start; }
.doc-icon { font-size: 1.3rem; }
.doc-title { margin: 0; font-size: 1rem; color: var(--teal-dark); }
.doc-desc { margin: 3px 0 0; color: var(--muted); font-size: 0.9rem; }
.doc-meta { margin-top: 6px; display: flex; gap: 16px; color: var(--muted); font-size: 0.8rem; }
.doc-actions { white-space: nowrap; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Chips / badges ---- */
.chip-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--teal-light); color: var(--teal-dark); padding: 5px 10px; border-radius: 20px; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.chip-x { background: none; border: none; color: var(--teal-dark); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }
.tag { background: #eef1f3; color: var(--muted); padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; }
.role-badge { padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.role-lector { background: #eef1f3; color: #555; }
.role-editor { background: #fff3d6; color: #8a6100; }
.role-admin { background: var(--teal-light); color: var(--teal-dark); }

/* ---- Gestión de logos ---- */
.logo-manage { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.logo-preview {
  min-width: 180px; min-height: 80px; padding: 12px 18px;
  border: 1px dashed var(--line); border-radius: 8px; background: #fafcfc;
  display: flex; align-items: center; justify-content: center;
}
.logo-preview img { max-height: 70px; max-width: 240px; width: auto; }
.logo-placeholder { color: var(--muted); font-size: 0.85rem; }
.logo-forms { display: flex; flex-direction: column; gap: 10px; }

/* ---- Empty ---- */
.empty { text-align: center; padding: 48px 20px; background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---- Search ---- */
.search { display: flex; gap: 10px; margin-top: 16px; max-width: 520px; }
.search input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--line); background: var(--white); padding: 20px 0; color: var(--muted); font-size: 0.85rem; }
.footer .container { padding: 0 24px; }
