/* WorkPlan · KPI PSM (blanco + azules) */
/* ===== Mapa de Puntos de Trabajo ===== */
.map-container {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: #f8fafc;
  margin-top: 10px;
}

.map-bg {
  width: 100%;
  height: auto;
  display: block;
}

.pins-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -100%);
  /* Punta del pin en el centro horizontal, base abajo */
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.map-pin:hover {
  transform: translate(-50%, -100%) scale(2.5);
  z-index: 20;
}

.pin-tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.map-pin:hover .pin-tooltip {
  opacity: 1;
}

.map-coordinates {
  position: absolute;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  pointer-events: none;
  z-index: 100;
  display: none;
  font-family: monospace;
}

.app-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar .field select {
  font-family: var(--font);
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.topbar .field select:hover {
  border-color: var(--blue);
}

.tabs {
  flex-wrap: nowrap !important;
}

.comment-item {
  background: var(--soft);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--blue);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-author {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}

.comment-date {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.comment-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  white-space: pre-wrap;
}

:root {
  /* WorkPlan Colors */
  --bg: #0d1b24;
  /* Dark Teal Background */
  --panel: #162a35;
  /* Panel background */
  --panel-inner: #1c333f;
  --border: #243d4c;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f79471;
  --accent-soft: rgba(247, 148, 113, 0.15);
  --accent-grad: linear-gradient(135deg, #f79471, #ed7061);
  --blue: #38bdf8;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --radius: 12px;
  --font: 'Ubuntu', sans-serif;
}

.welcome-page {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: url('/Imagenes/PortadaRefineria.png') no-repeat center center;
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.welcome-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 36, 0.5);
  /* 50% transparency for the background overlay */
}

.welcome-card {
  position: relative;
  z-index: 2;
  background: rgba(22, 42, 53, 0.5);
  /* 50% transparency for the glass card */
  backdrop-filter: blur(20px);
  max-width: 600px;
  width: 100%;
  padding: 60px 40px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: welcomeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes welcomeIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.welcome-logo {
  width: 80px;
  height: 80px;
  background: var(--accent-grad);
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto 30px;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 10px 30px rgba(247, 148, 113, 0.4);
}

.welcome-title {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 20px;
  letter-spacing: -1px;
}

.welcome-title span {
  color: var(--accent);
}

.welcome-desc {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 40px;
}

.btn-start {
  padding: 18px 60px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 16px;
  background: var(--accent-grad);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 10px 20px rgba(247, 148, 113, 0.3);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(247, 148, 113, 0.4);
}

.app-hidden {
  display: none !important;
}

* {
  box-sizing: border-box
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.wrap {
  margin: 0 auto;
  padding: 24px;
}

.filters-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  /* Alinear a la derecha todo el grupo */
  width: 100%;
}

.filter-bar {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
  background: rgba(13, 27, 36, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(247, 148, 113, 0.3);
}

.title {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}

.subtitle {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Contrast enhancement for Topbar Selects */
.topbar select {
  background: #050d12 !important;
  /* Darker technical background */
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
  padding: 6px 12px;
  outline: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}

.topbar select option {
  background: var(--panel);
  color: var(--text);
}

.topbar select:hover {
  border-color: var(--blue) !important;
}

.topbar select:focus {
  border-color: var(--accent) !important;
}

.topbar #globalFilters {
  border-left: 1px solid var(--border) !important;
}

.tabs {
  display: flex;
  gap: 8px
}

.tab {
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text)
}

.tab.active {
  border-color: var(--blue);
  background: var(--soft);
  color: var(--blue);
  font-weight: 500;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.inner-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.field>input,
.field>select,
textarea {
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--panel-inner);
  outline: none;
  transition: all 0.2s;
}

.field>input:focus,
.field>select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #233d4d;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field.wide {
  grid-column: 1/-1;
}

.btn {
  border: none;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(247, 148, 113, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(247, 148, 113, 0.3);
}

.btn.secondary {
  background: #233d4d;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.secondary:hover {
  background: #2d4a5d;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px
}

.kpi-row-centered {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.kpi-row-centered .kpi-card {
  width: calc(25% - 9px);
  /* Matches the width of 1/4 grid minus gap */
}

.kpi-big-card {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

.kpi-card {
  background: var(--panel-inner);
  border-radius: 15px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  border-left: 4px solid var(--accent);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 1px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin: 10px 0;
}

.kpi-foot {
  font-size: 12px;
  color: var(--blue);
  opacity: 0.8;
}

/* Gradients for special KPIs - like the image */
.kpi-card:nth-child(1) {
  background: linear-gradient(145deg, #1c333f, #152a35);
}

.kpi-card:nth-child(2) {
  background: linear-gradient(145deg, #1c333f, #152a35);
}

.kpi-card:nth-child(3) {
  background: linear-gradient(145deg, #1c333f, #152a35);
}

.kpi-card:nth-child(4) {
  background: linear-gradient(145deg, #1c333f, #152a35);
}

.kpi-card:nth-child(5) {
  background: linear-gradient(145deg, #1c333f, #152a35);
}

.kpi-card:nth-child(6) {
  background: linear-gradient(145deg, #1c333f, #152a35);
}


.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;

}

.chart-container {
  height: 220px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.inner {
  padding: 18px;
  border-radius: 10px;
  width: 100%;
}

.inner-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.inner-head h3 {
  margin: 0;
  font-size: 14px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.kv {
  display: grid;
  gap: 8px;
  margin-top: 10px
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff
}

.note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  background: var(--soft);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border)
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 980px
}

.table th {
  background: #1c333f;
  font-weight: 600;
  text-align: left;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.table tbody tr {
  cursor: pointer
}

.table tbody tr:hover {
  background: rgba(73, 130, 252, .04);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px
}

.badge.ok {
  background: rgba(30, 89, 41, 0.08);
  color: var(--ok);
  border: none;
}

.badge.warn {
  background: rgba(199, 166, 70, 0.1);
  color: var(--warn);
  border: none;
}

.badge.danger {
  background: rgba(252, 106, 73, 0.1);
  color: var(--danger);
  border: none;
}

.bars {
  display: grid;
  gap: 10px;
  margin-top: 10px
}

.barLegend {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block
}

.dot.plan {
  background: rgba(37, 99, 235, .9)
}

.dot.rep {
  background: rgba(220, 38, 38, .9)
}

.barRow {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: flex-start
}

.barLabel {
  font-size: 12px;
  color: var(--muted);
  padding-top: 2px
}

.barTrack {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.barLine {
  height: 10px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.barPlan,
.barRep {
  height: 100%;
  border-radius: 999px
}

.barPlan {
  background: linear-gradient(90deg, rgba(37, 99, 235, .35), rgba(37, 99, 235, .95))
}

.barRep {
  background: linear-gradient(90deg, rgba(220, 38, 38, .35), rgba(220, 38, 38, .95))
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 3000;
}

.modal[aria-hidden="false"] {
  display: block
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 36, 0.85);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  max-height: 90%;
  z-index: 25;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 1100px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  margin: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 30px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-inner);
  height: 80px;
}

.modal-title {
  font-weight: 800;
  font-size: 20px;
  color: var(--accent);
}

.modal-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Compact modal for meta and small forms */
.compact-modal .modal-head {
  padding: 12px 20px;
}

.compact-modal .modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body {
  padding: 30px;
  overflow-y: auto;
  max-height: calc(90vh - 160px);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 30px;
  border-top: 1px solid var(--border);
  background: var(--panel-inner);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 27, 36, 0.85);
  backdrop-filter: blur(8px);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px
}

.section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border)
}

.section h4 {
  margin: 0 0 10px;
  font-size: 13px
}

.hh-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

.hh-col {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-inner);
  padding: 16px;
}

.hh-title {
  font-weight: 800;
  font-size: 12px;
  color: var(--muted)
}

.hh-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 10px
}

.hh-row input {
  width: 100%
}

.hh-sum {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted)
}

@media (max-width:1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr)
  }

  .grid-2 {
    grid-template-columns: 1fr
  }

  .form-grid {
    grid-template-columns: 1fr
  }
}


/* Accordion menu (Detalle operación) */
.modal-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px
}

.acc {
  display: grid;
  gap: 10px;
  max-height: 280px;
}

.acc-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  background: var(--panel-inner);
  padding: 13px 20px;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.acc-item:hover {
  border-color: var(--accent);
  transform: scale(1.01);
}

.acc-title {
  font-weight: 800;
  color: var(--text);
  font-size: 14px;
}

.acc-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.acc-panel {
  display: none;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.15);
  margin-top: 8px;
  margin-bottom: 16px;
}

.acc-item.is-open+.acc-panel {
  display: block
}


/* Day columns in tables (HH plan por día) */
th.day,
td.day-num {
  width: 56px;
  text-align: center
}

td.day-num {
  font-variant-numeric: tabular-nums;
  color: var(--blue2)
}

.table .btn-link {
  padding: 6px 10px
}

.modal-wide {
  max-width: 1100px
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px
}


/* HH stacked in day cells: Plan (azul) arriba, Reporte (rojo) abajo */
.day-cell {
  padding: 6px 6px;
  text-align: center;
  vertical-align: middle
}

.hh {
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-weight: 800
}

.hh-plan {
  color: var(--blue);
}

.hh-rep {
  color: var(--accent);
}


/* Header: sumatoria HH por día (Plan/Rep) */
th.day {
  vertical-align: bottom;
}

.day-name {
  font-weight: 600;
}

.day-sums {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  font-size: 12px;
  line-height: 1.05;
  margin-top: 2px;
}

.day-sums .hh {
  padding: 0;
  background: transparent;
  border: 0;
}

/* ===== HH Vertical Chart (Plan vs Reporte) ===== */
.hhv-wrap {
  padding: 8px 0;
}

.hhv-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 700;
}

.hhv-legend .dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.hhv-legend .dot.plan {
  background: var(--blue);
}

.hhv-legend .dot.rep {
  background: var(--danger);
}

/* rojo */

.hhv-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  gap: 12px;
  align-items: end;
  height: 200px;
  padding: 20px 10px 10px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
}

.hhv-group {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.hhv-bars {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.hhv-bar {
  width: 40%;
  min-width: 8px;
  border-radius: 6px 6px 2px 2px;
  transition: height .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.hhv-bar.plan {
  background: var(--blue);
}

.hhv-bar.rep {
  background: var(--danger);
}

.hhv-label {
  font-weight: 700;
  font-size: 12px;
  opacity: .9;
}

.hhv-hint {
  font-size: 11px;
  opacity: .75;
}

.hidden {
  display: none !important;
}

/* ===== Diagrama de Gantt (Estilo Primavera P6) ===== */
.gantt-container {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  max-height: 700px;
  overflow: auto;
}

.gantt-wrapper {
  min-width: 100%;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  background: var(--panel);
}

.gantt-sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  left: 0;
  z-index: 10;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.2);
}

.gantt-sidebar-title {
  padding: 16px;
  font-weight: 800;
  color: var(--accent);
  background: var(--panel-inner);
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: sticky;
  top: 0;
  z-index: 20;
  height: 62px;
  /* High enough to stay above sidebar labels */
}

.gantt-content {
  background: var(--bg);
}

.gantt-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  position: sticky;
  top: 0;
  background: var(--panel-inner);
  z-index: 15;
  border-bottom: 2px solid var(--border);
  height: 62px;
  align-items: center;
}

.gantt-day-header {
  text-align: center;
  padding: 4px 6px;
  font-size: 11px;
  color: var(--muted);
  border-right: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gantt-day-header:last-child {
  border-right: none;
}

.gantt-row-label {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: 62px;
  justify-content: center;
  transition: background 0.2s;
  overflow: hidden;
}

.gantt-row-label .op-id {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.gantt-row-label .op-desc {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-timeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  height: 62px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.gantt-day {
  background: transparent;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  gap: 2px;
}

.gantt-day:not(:last-child) {
  border-right: 1px dashed #f3f4f6;
}

.gantt-bar {
  border-radius: 4px;
  margin: 0 4px;
  min-height: 18px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gantt-bar-plan {
  background: rgba(56, 189, 248, 0.15);
  color: var(--blue);
  border: 1px solid var(--blue);
}

.gantt-bar-rep {
  background: var(--accent-grad);
  color: #fff;
}

.gantt-bar-empty {
  flex-grow: 1;
  min-height: 14px;
  opacity: 0;
  background: transparent;
  border-radius: 0;
}

.gantt-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
  font-size: 12px;
  background: #f9fafb;
}

/* Tabla Asistencia */
.table-asistencia {
  margin-top: 10px;
  background: var(--panel-inner);
}

.table-asistencia thead .red-header th {
  background: var(--accent);
  color: #000;
  /* Dark text for better contrast on salmon/accent */
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.table-asistencia thead .date-header th {
  background: var(--bg);
  color: var(--text);
  font-size: 10px;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid var(--border);
}

.table-asistencia td {
  padding: 8px 4px;
  text-align: center;
}

.table-asistencia td input {
  width: 100%;
  max-width: 60px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
  padding: 4px;
  font-size: 13px;
  border-radius: 4px;
}

.table-asistencia td input:focus {
  border-color: var(--accent);
  background: rgba(247, 148, 113, 0.1);
  outline: none;
}

.table-asistencia .role-label {
  text-align: left;
  padding-left: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  width: 140px;
}

.table-asistencia .row-total td,
.table-asistencia .row-hours td,
.table-asistencia .row-available td {
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.table-asistencia .row-available {
  color: var(--accent);
}

/* Auth & Admin Styles */
.user-info-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-inner);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  font-size: 13px;
}

#userEmail {
  font-weight: 500;
  color: var(--text);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #fff;
}

.wide {
  width: 100%;
}

#section-admin .btn.secondary {
  flex-direction: column;
  height: auto;
  min-height: 100px;
  justify-content: center;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

#section-admin .btn.secondary:hover {
  background: var(--panel-inner);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-icon-profile {
  background: var(--border);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.btn-icon-profile:hover {
  background: var(--accent);
  transform: scale(1.1);
}

/* Estilos para KPI Split Cards */
.kpi-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 12px;
}

.kpi-sub {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.kpi-val-sm {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.kpi-lbl-sm {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 2px;

}

/* Compact Table for Planning Section */
.table-compact {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.table-compact th {
  background: #1c333f;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  padding: 8px 6px;
  text-align: center;
  border-bottom: 2px solid var(--border);
  font-size: 10px;
}

.table-compact th:first-child {
  text-align: left;
  padding-left: 12px;
}

.table-compact td {
  padding: 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table-compact td:first-child {
  text-align: left;
  padding-left: 12px;
  font-weight: 600;
  color: var(--text);
}

.table-compact tr:last-child td {
  border-bottom: none;
}

.table-compact .col-total {
  border-left: 1px solid var(--border);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.02);
}

.table-compact input {
  width: 100%;
  max-width: 60px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  text-align: center;
  padding: 4px;
  font-size: 11px;
  border-radius: 4px;
  transition: all 0.2s;
}

.table-compact input:focus {
  border-color: var(--accent);
  background: rgba(247, 148, 113, 0.1);
  outline: none;
}

/* ========================================= */
/* ===== RESPONSIVE & iOS EXPERIENCE  ===== */
/* ========================================= */

:root {
  /* iPhone-like high density colors */
  --ios-bg: #f2f2f7;
  --ios-panel: #ffffff;
  --ios-blue: #007aff;
  --ios-separator: rgba(60, 60, 67, 0.36);
  /* Dark mode variants for our teal theme */
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* System Font overwrite for iOS feel */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* Bottom Nav for Mobile */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + var(--safe-area-bottom));
  background: rgba(22, 42, 53, 0.82);
  backdrop-filter: blur(25px) saturate(180%);
  border-top: 1px solid var(--border);
  z-index: 1000;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  padding-bottom: var(--safe-area-bottom);
  box-shadow: 0 -1px 15px rgba(0, 0, 0, 0.2);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 8px 0;
}

.nav-item.active {
  color: var(--blue);
}

.nav-item .nav-icon {
  font-size: 20px;
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.planning-tables-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  /* Optimized horizontal ratio for desktop */
  gap: 20px;
  margin: 20px 0;
}

@media (max-width: 900px) {
  .mobile-bottom-nav {
    display: flex;
  }

  .topbar {
    padding: 10px 16px;
  }

  /* Hide top selector logic in mobile */
  .topbar #sectionSelector {
    display: none;
  }

  .wrap {
    padding: 12px;
    padding-bottom: calc(85px + var(--safe-area-bottom));
  }

  .brand .logo {
    width: 36px;
    height: 36px;
    font-size: 14px;
    border-radius: 8px;
  }

  .brand .title {
    font-size: 14px;
  }

  .brand .subtitle {
    display: none;
  }

  #globalFilters {
    flex: none;
    padding-left: 10px !important;
  }

  #globalFilters .field span {
    display: none;
  }

  .top-bar-auth {
    margin-right: 0 !important;
  }

  .top-bar-auth #userEmail {
    display: none;
  }

  /* KPI Grid responsive */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }

  .kpi-card {
    padding: 16px;
    border-radius: 18px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .grid-2 {
    grid-template-columns: 1fr !important;
  }

  .panel {
    border-radius: 20px;
  }

  .gantt-wrapper {
    grid-template-columns: 160px 1fr !important;
    /* Smaller sidebar on mobile */
  }

  .gantt-sidebar {
    min-width: 160px;
  }

  .gantt-row-label {
    padding: 8px !important;
  }

  .op-id {
    font-size: 11px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
  }

  /* Optimized Mobile Filters & Section Menus */
  .inner-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 16px !important;
    margin-bottom: 20px;
  }

  .inner-head h3 {
    font-size: 16px !important;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
    margin-bottom: 4px;
    margin-top: 0;
  }

  .filter-bar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px !important;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  }

  .filter-bar .field {
    flex: 1 1 calc(50% - 10px);
    margin: 0 !important;
  }

  .filter-bar .field span {
    font-size: 10px;
    margin-bottom: 4px;
    color: var(--blue);
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
    height: 44px !important;
    background: rgba(13, 27, 36, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    font-size: 14px !important;
  }

  .filter-bar .btn {
    flex: 1 1 100%;
    margin: 8px 0 0 0 !important;
    height: 48px;
    border-radius: 14px;
    font-size: 15px;
    box-shadow: 0 8px 20px rgba(247, 148, 113, 0.3);
    justify-content: center;
    display: flex;
    align-items: center;
  }

  /* Specific planning section fixes */
  #section-planning .grid-2 {
    grid-template-columns: 1fr !important;
  }

  .table-compact {
    font-size: 11px !important;
  }

  .planning-tables-grid {
    grid-template-columns: 1fr;
    /* Stack vertically on mobile */
  }
}

/* Glassmorphism Refinement for Panels */
.panel {
  background: rgba(22, 42, 53, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1%;
  border-radius: 10px;
}

/* Modals iOS style */
.modal-card {
  border-radius: 24px;
  max-height: 90vh;
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
}

.modal-head {
  border-bottom: 0.5px solid var(--ios-separator);
}

/* Compact tables on small screens */
@media (max-width: 600px) {
  .table-wrap {
    margin: 0 -4px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .table th,
  .table td {
    padding: 10px 6px;
    font-size: 12px;
  }
}

/* Custom Scrollbars for mobile */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
}