

:root {
  --primary:   #003e7e;
  --accent:    #0d6efd;
  --top-bar:   #002d5c;
  --primary-dk:#002a5a;
  --green:     #198754;
  --amber:     #fd7e14;
  --red:       #dc3545;
  --bg:        #f0f6ff;
  --white:     #ffffff;
  --border:    #dde8f7;
  --text:      #1a1a2e;
  --text-2:    #555;
  --text-3:    #888;
}
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; background: var(--bg); color: var(--text); margin: 0; }
img  { max-width: 100%; }


.topbar {
  background: var(--top-bar);
  border-bottom: 2px solid var(--accent);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 8px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}
.topbar-brand img {
  height: 34px;
  width: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.3);
  flex-shrink: 0;
}
.brand-name {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub { font-size: .68rem; opacity: .75; display: none; }
.topbar-nav { display: flex; gap: 4px; flex-shrink: 0; }
.topbar-nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background .2s;
  white-space: nowrap;
}
.topbar-nav a:hover  { background: rgba(255,255,255,.12); color: #fff; }
.topbar-nav a.active { background: var(--accent); color: #fff; }
.topbar-nav a .nav-label { display: none; }


.turnos-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #0a5aa0 100%);
  color: #fff;
  padding: 20px 16px;
  text-align: center;
  border-bottom: 3px solid var(--accent);
}
.turnos-hero h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}
.turnos-hero p { font-size: .78rem; opacity: .8; margin: 0; }
.hero-pills {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.hero-pill {
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .72rem;
  display: flex;
  align-items: center;
  gap: 4px;
}


.steps-bar {
  display: flex;
  align-items: center;
  padding: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.steps-bar::-webkit-scrollbar { display: none; }
.step-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .7rem;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.step-item.done { color: var(--green); }
.step-item.cur  { color: var(--primary); font-weight: 700; }
.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-item.done .step-dot { background: #d1f5e0; border-color: var(--green); color: var(--green); }
.step-item.cur  .step-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-label { display: none; }
.step-line { flex: 1; height: 1px; background: #dde; margin: 0 4px; min-width: 12px; }


.card-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,62,126,.06);
}
.card-section-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}


.espec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.espec-card {
  background: #f7fbff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.espec-card:active,
.espec-card:hover   { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,110,253,.1); }
.espec-card.selected{ border: 2px solid var(--accent); background: #e8f0fe; }
.espec-icon { font-size: 1.6rem; color: var(--primary); margin-bottom: 6px; display: block; }
.espec-name { font-size: .8rem; font-weight: 700; color: var(--primary); margin-bottom: 2px; line-height: 1.2; }
.espec-count { font-size: .68rem; color: var(--text-3); margin-top: 3px; }


.prof-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.prof-card {
  background: #f7fbff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.prof-card:active,
.prof-card:hover    { border-color: var(--accent); }
.prof-card.selected { border: 2px solid var(--accent); background: #e8f0fe; }
.prof-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #dce8f8;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 700; color: var(--primary);
  flex-shrink: 0;
}
.prof-nombre  { font-size: .85rem; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.prof-meta    { font-size: .72rem; color: var(--text-2); }
.prof-horario { font-size: .68rem; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 3px; }


.prof-info-box {
  background: #e8f0fe;
  border: 1px solid #b8d0f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  margin-bottom: 14px;
}
.pib-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  flex-shrink: 0;
}


.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 8px; }
.cal-day-lbl { text-align: center; font-size: .65rem; color: var(--text-3); font-weight: 600; padding: 3px 0; }
.cal-day {
  text-align: center;
  padding: 8px 2px;
  font-size: .78rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .1s;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day:active,
.cal-day:hover     { background: #e8f0fe; }
.cal-day.selected  { background: var(--primary) !important; color: #fff !important; border-color: var(--primary); }
.cal-day.today     { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.cal-day.today.selected { color: #fff; }
.cal-day.disabled  { color: #ccc; cursor: default; }
.cal-day.nowork    { color: #ccc; cursor: default; background: #f8f9fa; }


.turno-bloque-titulo {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg);
  border-radius: 8px;
  padding: 5px 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tgrid { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; }
.tc {
  border: 1.5px solid #dde;
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  transition: all .12s;
  -webkit-tap-highlight-color: transparent;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.tc:active:not(.ocu):not(.bloq),
.tc:hover:not(.ocu):not(.bloq)  { border-color: var(--accent); }
.tc.selected   { background: var(--accent); border-color: var(--accent); color: #fff; }
.tc.ocu        { opacity: .4; cursor: default; }
.tc.bloq       { background: #f8f9fa; cursor: default; border-style: dashed; opacity: .65; }
.tc.prog       { border-color: var(--green); background: #d1f5e0; }
.tc.prog.selected { background: #157347; border-color: #157347; color: #fff; }
.tcn { font-size: 1rem; font-weight: 700; line-height: 1; }
.tcl { font-size: .62rem; margin-top: 2px; color: var(--text-3); }
.tc.selected .tcl, .tc.prog.selected .tcl { color: rgba(255,255,255,.75); }
.tc.prog .tcl { color: #157347; }


.aviso {
  border-radius: 10px;
  padding: 8px 12px;
  font-size: .78rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.av-bl { background: #cfe2ff; color: #084298; }
.av-gn { background: #d1f5e0; color: #0a4022; }
.av-am { background: #ffe5cc; color: #7c3400; }
.av-rd { background: #f8d7da; color: #842029; }

.tag { font-size: .68rem; padding: 2px 7px; border-radius: 20px; font-weight: 600; display: inline-block; }
.tag-prog { background: #d1f5e0; color: #0a4022; }
.tag-dem  { background: #cfe2ff; color: #084298; }
.tag-rep  { background: #ffe5cc; color: #7c3400; }
.fs-xs    { font-size: .7rem; }

.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: .7rem; color: var(--text-3); margin-top: 8px; }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; border: 1.5px solid #ccc; }
.ld-prog { background: #d1f5e0; border-color: #75c98f; }
.ld-dem  { background: #cfe2ff; border-color: #84b0f0; }


.form-label { font-size: .82rem; font-weight: 600; color: var(--primary); margin-bottom: 3px; }
.form-control, .form-select {
  font-size: .85rem;
  border-color: #bdd0ee;
  padding: 10px 12px;
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}
.form-interno { background: var(--bg); border-radius: 12px; padding: 14px; border: 1px solid #bdd0ee; }


.confirm-box {
  background: #d1f5e0;
  border: 1.5px solid #75c98f;
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
}
.confirm-icon {
  width: 52px; height: 52px;
  background: var(--white);
  border-radius: 50%;
  border: 2.5px solid var(--green);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.confirm-icon i { font-size: 1.4rem; color: var(--green); }
.confirm-num    { font-size: 1.6rem; font-weight: 700; color: #0a4022; }

.wp-preview { background: #e5f5e0; border-radius: 12px; padding: 12px; margin-top: 12px; border: 1px solid #b8deb4; }
.wp-header  { font-size: .75rem; color: #2d6a4f; margin-bottom: 7px; display: flex; align-items: center; gap: 5px; font-weight: 600; }
.wp-bubble  { background: #dcf8c6; border-radius: 0 10px 10px 10px; padding: 9px 12px; font-size: .78rem; color: #111; line-height: 1.6; max-width: 95%; }


.mis-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  box-shadow: 0 1px 6px rgba(0,62,126,.05);
}
.mis-card.reprog { border-color: var(--amber); background: #fff8f0; }
.mis-date { background: #e8f0fe; border-radius: 10px; padding: 7px 10px; text-align: center; min-width: 46px; flex-shrink: 0; }
.mis-date-d { font-size: 1rem; font-weight: 700; color: var(--primary); line-height: 1; }
.mis-date-m { font-size: .65rem; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; }


.nav-pills-vargas .nav-link { color: var(--primary); font-size: .82rem; font-weight: 600; border-radius: 8px; }
.nav-pills-vargas .nav-link.active { background: var(--primary); color: #fff; }
.nav-pills-vargas .nav-link:hover:not(.active) { background: #e8f0fe; }


.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stat-val  { font-size: 1.4rem; font-weight: 700; }
.stat-lbl  { font-size: .72rem; color: var(--text-3); }


.adm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.adm-table-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: .78rem;
  margin-bottom: 5px;
  background: #f7fbff;
  min-width: 500px;
}
.adm-table-row.cols-t { grid-template-columns: 95px minmax(0,1.5fr) minmax(0,1fr) 55px 65px 85px; }
.adm-hdr {
  display: grid;
  gap: 8px;
  padding: 4px 12px;
  font-size: .68rem;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
  min-width: 500px;
}
.adm-hdr.cols-t { grid-template-columns: 95px minmax(0,1.5fr) minmax(0,1fr) 55px 65px 85px; }


.med-admin-card { background: #f7fbff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.med-admin-card .med-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.med-admin-avatar { width: 40px; height: 40px; border-radius: 50%; background: #dce8f8; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; color: var(--primary); flex-shrink: 0; }
.med-admin-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; font-size: .76rem; }
.med-admin-info-item { background: var(--white); border-radius: 8px; padding: 7px 10px; border: 1px solid var(--border); }
.med-admin-info-item .lbl { color: var(--text-3); font-size: .66rem; margin-bottom: 2px; }
.med-admin-info-item .val { font-weight: 600; color: var(--primary); }
.espec-admin-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 6px; background: #f7fbff; font-size: .82rem; }


.usr-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: .78rem;
  margin-bottom: 6px;
  background: #f7fbff;
}
.usr-row > div:first-child { flex: 1; min-width: 120px; }
.log-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: .76rem;
  margin-bottom: 5px;
  background: #f7fbff;
}


.dia-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid #bdd0ee; font-size: .75rem; font-weight: 600; cursor: pointer; background: transparent; transition: all .12s; }
.dia-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.ntif { border-radius: 10px; padding: 10px 14px; font-size: .8rem; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ntif.ok   { background: #d1f5e0; border: 1px solid #75c98f; color: #0a4022; }
.ntif.err  { background: #f8d7da; border: 1px solid #f1aeb5; color: #842029; }
.ntif.warn { background: #ffe5cc; border: 1px solid #ffb380; color: #7c3400; }
.ntif.info { background: #cfe2ff; border: 1px solid #84b0f0; color: #084298; }
.reprog-banner { border: 2px solid var(--amber); background: #fff3e0; border-radius: 14px; padding: 14px; margin-bottom: 12px; }


.btn { font-size: .82rem; padding: 8px 16px; border-radius: 8px; }
.btn-sm { font-size: .75rem; padding: 5px 10px; }
.btn-primary { background: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-primary:hover, .btn-primary:active { background: var(--primary-dk); border-color: var(--primary-dk); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }


@media (min-width: 576px) {
  .topbar-brand img { height: 38px; width: 38px; }
  .brand-sub  { display: block; }
  .topbar-nav a .nav-label { display: inline; }
  .turnos-hero h1 { font-size: 1.3rem; }
  .espec-grid { grid-template-columns: repeat(3, 1fr); }
  .prof-grid  { grid-template-columns: repeat(2, 1fr); }
  .step-label { display: inline; }
  .tgrid { grid-template-columns: repeat(5, 1fr); }
  .med-admin-info-grid { grid-template-columns: repeat(2, 1fr); }
}


@media (min-width: 768px) {
  .topbar { padding: 8px 20px; }
  .card-section { padding: 18px; }
  .turnos-hero  { padding: 28px 20px; }
  .turnos-hero h1 { font-size: 1.5rem; }
  .espec-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .prof-grid  { grid-template-columns: repeat(2, 1fr); }
  .med-admin-info-grid { grid-template-columns: repeat(4, 1fr); }
  /* Paso 3: calendario + turnos lado a lado */
  .paso3-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}

@media (min-width: 992px) {
  .espec-grid { grid-template-columns: repeat(4, 1fr); }
}
