* {
  box-sizing: border-box;
}

:root {
  --navy: #0b2854;
  --navy2: #124d82;
  --blue: #1769e8;
  --blue2: #2e82f6;
  --green: #08a95c;
  --green-dark: #087942;
  --orange: #f3a600;
  --red: #ed4148;
  --purple: #7543ef;
  --gray: #73839b;

  --text: #102142;
  --muted: #66758e;
  --border: #dce5f2;
  --background: #f4f7fc;
  --white: #fff;

  --shadow:
    0 8px 26px rgba(19, 54, 105, .08);
}

body {
  margin: 0;
  font-family:
    Inter,
    "Segoe UI",
    Arial,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      #ffffff 0,
      #f4f7fc 35%,
      #eef4fb 100%
    );
}

.app {
  width: min(1800px, calc(100% - 38px));
  margin: 0 auto;
  padding: 24px 0 55px;
}


/* HEADER */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 22px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: white;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  background:
    linear-gradient(145deg, #1769e8, #0a3d8f);
  box-shadow:
    0 8px 20px rgba(23,105,232,.25);
}

.brand-divider {
  width: 1px;
  height: 48px;
  background: #d5deeb;
}

.eyebrow,
.modal-eyebrow {
  color: var(--blue);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -.8px;
  color: #0b1d3d;
}

.subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.sync-box {
  text-align: right;
}

.sync-status {
  font-size: 13px;
  font-weight: 800;
  color: #142747;
}

.sync-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  background: #0fbd6d;
  box-shadow:
    0 0 0 4px rgba(15,189,109,.1);
}

.sync-time {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

.btn-primary {
  border: 0;
  border-radius: 11px;
  padding: 13px 18px;
  color: white;
  background:
    linear-gradient(135deg, #1769e8, #0956d1);
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    0 7px 18px rgba(23,105,232,.22);
}

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

.refresh-icon {
  margin-right: 5px;
  font-size: 17px;
}


/* KPI */

.kpis {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  position: relative;
  min-height: 140px;
  overflow: hidden;
  display: flex;
  gap: 13px;
  padding: 19px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: white;
  box-shadow: var(--shadow);
}

.kpi::after {
  content: "";
  position: absolute;
  width: 85px;
  height: 85px;
  right: -30px;
  bottom: -35px;
  border-radius: 50%;
  opacity: .09;
  background: currentColor;
}

.kpi-icon {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 17px;
}

.kpi-content {
  min-width: 0;
}

.kpi-label {
  font-size: 11px;
  line-height: 1.25;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .3px;
}

.kpi-value {
  margin-top: 5px;
  font-size: 31px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -1px;
}

.kpi-foot {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.kpi-total {
  color: #125ec9;
  background:
    linear-gradient(145deg, #fff, #f1f7ff);
}

.kpi-total .kpi-icon {
  background: #2580ec;
}

.kpi-success {
  color: var(--green-dark);
  background:
    linear-gradient(145deg, #fff, #ebfbf3);
}

.kpi-success .kpi-icon {
  background: var(--green);
}

.kpi-development {
  color: #145ad4;
  background:
    linear-gradient(145deg, #fff, #edf5ff);
}

.kpi-development .kpi-icon {
  background: var(--blue);
}

.kpi-pending {
  color: #a46700;
  background:
    linear-gradient(145deg, #fff, #fff7df);
}

.kpi-pending .kpi-icon {
  background: var(--orange);
}

.kpi-paused {
  color: #c8232a;
  background:
    linear-gradient(145deg, #fff, #fff0f1);
}

.kpi-paused .kpi-icon {
  background: var(--red);
}

.kpi-nostate {
  color: #536780;
  background:
    linear-gradient(145deg, #fff, #f2f5f9);
}

.kpi-nostate .kpi-icon {
  background: #7186a2;
}

.kpi-progress {
  color: #6b36e6;
  background:
    linear-gradient(145deg, #fff, #f4efff);
}

.kpi-progress .kpi-icon {
  background: var(--purple);
}

.mini-progress {
  width: 100%;
  height: 7px;
  background: #e7e5f4;
  border-radius: 30px;
  overflow: hidden;
  margin-top: 8px;
}

.mini-progress div {
  height: 100%;
  width: 0;
  border-radius: 30px;
  background:
    linear-gradient(90deg, #7b46ef, #9b65ff);
}


/* ANALYTICS */

.analytics-grid {
  display: grid;
  grid-template-columns: .95fr 1.25fr .95fr;
  gap: 15px;
  margin-bottom: 16px;
}

.panel {
  overflow: hidden;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.panel-title {
  min-height: 67px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 18px;
  color: white;
  background:
    linear-gradient(
      110deg,
      var(--navy),
      var(--navy2)
    );
}

.panel-icon {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.13);
  font-weight: 900;
}

.panel-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.panel-title p {
  margin: 3px 0 0;
  font-size: 11px;
  color: #d9e7f6;
}

.status-chart,
.category-chart,
.team-chart {
  padding: 18px;
}

.status-row,
.team-row {
  margin-bottom: 14px;
}

.status-info,
.team-info {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 6px;
  font-size: 12px;
}

.status-info strong,
.team-info strong {
  color: #102142;
  font-size: 12px;
}

.chart-track {
  height: 8px;
  overflow: hidden;
  background: #eaf0f7;
  border-radius: 20px;
}

.chart-bar {
  height: 100%;
  border-radius: 20px;
  background:
    linear-gradient(90deg, #1769e8, #448cf0);
}

.chart-bar.entregado {
  background:
    linear-gradient(90deg, #08a95c, #28c979);
}

.chart-bar.desarrollo {
  background:
    linear-gradient(90deg, #1769e8, #408cff);
}

.chart-bar.pendiente {
  background:
    linear-gradient(90deg, #eda000, #ffc32f);
}

.chart-bar.pausado {
  background:
    linear-gradient(90deg, #e83a42, #ff656b);
}

.chart-bar.sin-estado {
  background:
    linear-gradient(90deg, #71829a, #a1adbd);
}

.category-row {
  display: grid;
  grid-template-columns:
    minmax(140px, 1.5fr)
    1.7fr
    38px
    42px;
  gap: 9px;
  align-items: center;
  margin-bottom: 13px;
}

.category-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #314361;
  font-size: 11px;
  font-weight: 650;
}

.category-value,
.category-pct {
  text-align: right;
  font-size: 11px;
  font-weight: 900;
}

.category-pct {
  color: var(--muted);
}

.team-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #174a9e;
  background: #e3edff;
  font-size: 10px;
  font-weight: 900;
}


/* FILTERS */

.filter-panel {
  display: grid;
  grid-template-columns:
    minmax(300px, 2fr)
    1fr 1fr 1fr auto;
  gap: 10px;
  padding: 13px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: white;
  box-shadow: var(--shadow);
}

.search-wrap {
  position: relative;
}

.search-wrap span {
  position: absolute;
  left: 14px;
  top: 11px;
  color: #59708f;
  font-weight: 800;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid #d5e0ef;
  border-radius: 10px;
  outline: 0;
  background: white;
  color: #1d3150;
  font-weight: 600;
}

.search-wrap input {
  padding-left: 39px;
}

input:focus,
select:focus {
  border-color: #6aa0ef;
  box-shadow:
    0 0 0 3px rgba(23,105,232,.08);
}

.btn-clear {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  color: #1558bd;
  background: #edf4ff;
  font-weight: 900;
}


/* TABLE */

.projects-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
}

.projects-title {
  min-height: 65px;
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: white;
  background:
    linear-gradient(
      110deg,
      var(--navy),
      var(--navy2)
    );
}

.projects-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.projects-title h2 span {
  margin-right: 6px;
}

.projects-title p {
  margin: 4px 0 0;
  color: #dbe8f7;
  font-size: 11px;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
}

thead {
  background: #f3f7fc;
}

th {
  padding: 12px 14px;
  text-align: left;
  color: #526785;
  border-bottom: 1px solid #dce5f1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 900;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid #e9eef5;
  color: #354764;
  font-size: 12px;
  vertical-align: middle;
}

tbody tr {
  transition: background .15s;
}

tbody tr:hover {
  background: #f7faff;
}

.row-number {
  width: 30px;
  color: #8794a7;
  font-weight: 800;
}

.project-name {
  max-width: 330px;
  color: #102142;
  font-size: 12.5px;
  font-weight: 900;
}

.category-cell {
  max-width: 260px;
  color: #536985;
}

.team-members {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px 4px 4px;
  border-radius: 20px;
  color: #314766;
  background: #f0f4fb;
  font-size: 10.5px;
  font-weight: 750;
}

.member-initial {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #205db9;
  background: #dce9ff;
  font-size: 9px;
  font-weight: 900;
}

.progress-cell {
  min-width: 145px;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-track {
  width: 90px;
  height: 7px;
  overflow: hidden;
  border-radius: 20px;
  background: #e5ebf4;
}

.progress-fill {
  height: 100%;
  border-radius: 20px;
  background:
    linear-gradient(90deg, #1769e8, #3188fa);
}

.progress-number {
  min-width: 35px;
  color: #12233e;
  font-size: 11px;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.badge-entregado {
  color: #087a43;
  background: #dff8eb;
}

.badge-desarrollo {
  color: #145cc8;
  background: #e2efff;
}

.badge-pendiente {
  color: #956000;
  background: #fff0bf;
}

.badge-pausado {
  color: #bd2229;
  background: #ffe0e2;
}

.badge-sin-estado {
  color: #53647b;
  background: #e7ecf2;
}

.btn-detail {
  border: 1px solid #cbdcf5;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  color: #155cc8;
  background: white;
  font-size: 10.5px;
  font-weight: 900;
}

.btn-detail:hover {
  color: white;
  border-color: #1769e8;
  background: #1769e8;
}

.empty {
  padding: 45px !important;
  text-align: center;
  color: var(--muted);
}


/* MODAL */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8,24,50,.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  border-radius: 19px;
  background: white;
  box-shadow:
    0 35px 90px rgba(4,19,45,.3);
}

.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background:
    linear-gradient(
      90deg,
      #0b2854,
      #1769e8,
      #7543ef
    );
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #40536f;
  background: #edf2f8;
  font-size: 20px;
}

.modal-card h2 {
  margin: 5px 45px 13px 0;
  color: #102142;
  font-size: 23px;
  font-weight: 900;
}

#modalEstado {
  margin-bottom: 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.detail-item,
.detail-section {
  padding: 14px;
  border: 1px solid #e1e8f2;
  border-radius: 11px;
  background: #f8faff;
}

.detail-item span,
.detail-section span {
  display: block;
  margin-bottom: 6px;
  color: #6d7d94;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-item strong {
  color: #142747;
  font-size: 12px;
}

.detail-section {
  margin-top: 11px;
}

.detail-section p {
  margin: 0;
  color: #263a58;
  font-size: 13px;
  line-height: 1.55;
}


/* RESPONSIVE */

@media (max-width: 1500px) {
  .kpis {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1100px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 800px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .sync-box {
    text-align: left;
  }

  .kpis {
    grid-template-columns: 1fr 1fr;
  }

  .brand-divider {
    display: none;
  }
}

@media (max-width: 600px) {
  .app {
    width: calc(100% - 20px);
  }

  .brand-mark {
    display: none;
  }

  h1 {
    font-size: 24px;
  }

  .kpis,
  .filter-panel,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
