/* ==========================================================================
   Kampus — mismo lenguaje visual que rovia.cl, hoja de estilos propia
   ========================================================================== */

:root {
  --navy-900: #071b3d;
  --navy-800: #0b2a57;
  --navy-700: #143767;
  --green-700: #4a701c;
  --green-600: #578722;
  --green-500: #6fa82c;
  --green-100: #e9f3dd;
  --gold-500: #f5b400;
  --gold-100: #fdf0cc;
  --red-600: #c0392b;
  --red-100: #fbe3e0;

  --bg: #ffffff;
  --bg-alt: #f6f8fb;
  --text: #10203d;
  --text-muted: #49577a;
  --border: #e3e8f0;

  --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(7, 27, 61, 0.06), 0 1px 1px rgba(7, 27, 61, 0.04);
  --shadow-md: 0 12px 32px -12px rgba(7, 27, 61, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-alt);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--navy-900);
  margin: 0;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ----- Header ----- */
.kampus-header {
  background: var(--navy-900);
  color: #fff;
  padding: 1rem 0;
}

.kampus-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.kampus-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.2rem;
}

.kampus-brand img {
  height: 28px;
  width: auto;
}

.kampus-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--green-500);
  color: #fff;
}

.btn--ghost-on-navy {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.btn--gold {
  background: var(--gold-500);
  color: var(--navy-900);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ----- Login ----- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy-900), var(--navy-800));
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem 2rem;
}

.login-card img {
  height: 34px;
  margin-bottom: 1.5rem;
}

.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.login-card p.sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 1.5rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-800);
}

.field input,
.field select {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--green-500);
  outline-offset: 1px;
}

.form-error {
  background: var(--red-100);
  color: var(--red-600);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 1rem;
}

.form-note {
  background: var(--green-100);
  color: var(--green-700);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 1rem;
}

/* ----- Layout general ----- */
.page {
  padding: 2.5rem 0 4rem;
}

.section-head {
  margin-bottom: 1.75rem;
}

.section-head .eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-700);
  margin-bottom: 0.4rem;
}

.section-head h2 {
  font-size: 1.6rem;
}

.section-head p {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* ----- Tarjetas de KPI (dashboard cliente) ----- */
.kpi-board {
  background: var(--navy-900);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  color: #eef3fb;
  display: grid;
  gap: 1.5rem;
}

.kpi-board-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  padding: 2rem 1rem;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.kpi-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.kpi-card-head h3 {
  color: #fff;
  font-size: 1.1rem;
}

.kpi-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.kpi-flag i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.kpi-flag--green {
  background: rgba(111, 168, 44, 0.18);
  color: #b7e07f;
}
.kpi-flag--green i {
  background: var(--green-500);
}

.kpi-flag--amber {
  background: rgba(245, 180, 0, 0.16);
  color: #ffd45a;
}
.kpi-flag--amber i {
  background: var(--gold-500);
}

.kpi-flag--red {
  background: rgba(224, 90, 74, 0.16);
  color: #ff9a8a;
}
.kpi-flag--red i {
  background: #e05a4a;
}

.kpi-flag--muted {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
}
.kpi-flag--muted i {
  background: rgba(255, 255, 255, 0.4);
}

.kpi-rows {
  display: grid;
  gap: 1.1rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem 1rem;
}

.kpi-row-label {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
}

.kpi-row-trend {
  font-size: 0.86rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.kpi-row-trend small {
  display: block;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
}

.kpi-bar-track {
  grid-column: 1 / -1;
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.kpi-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f7a1c, var(--green-500));
}

.kpi-before-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--gold-500);
}

.kpi-meta {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.6rem;
}

/* ----- Panel admin ----- */
.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.75rem;
  align-items: start;
}

.company-list {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.company-list-head {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.company-list-head h3 {
  font-size: 0.95rem;
}

.company-list ul {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  max-height: 60vh;
  overflow-y: auto;
}

.company-list li button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
}

.company-list li button:hover {
  background: var(--bg-alt);
}

.company-list li button.is-active {
  background: var(--green-100);
  color: var(--green-700);
  font-weight: 700;
}

.new-company-form {
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.6rem;
}

.new-company-form summary {
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--green-700);
  padding: 0.5rem 1.1rem;
}

.admin-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}

.admin-panel-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.upload-slot {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.upload-slot h4 {
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.upload-slot .phase-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.phase-tag--antes {
  background: var(--gold-100);
  color: #8a6100;
}

.phase-tag--despues {
  background: var(--green-100);
  color: var(--green-700);
}

.upload-slot input[type="file"] {
  width: 100%;
  font-size: 0.82rem;
  margin-top: 0.6rem;
}

.upload-status {
  margin-top: 0.6rem;
  font-size: 0.82rem;
}

.upload-status--ok {
  color: var(--green-700);
}

.upload-status--error {
  color: var(--red-600);
}

.upload-status--busy {
  color: var(--text-muted);
}

@media (max-width: 780px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .upload-grid {
    grid-template-columns: 1fr;
  }
}
