/* BIMTRAZA — Agenda (calendario). Cubre el área de trabajo; deja libres la barra y el menú lateral. */
#bimtraza-agenda.bt-ag {
  position: fixed;
  z-index: 21500;
  top: var(--bimtraza-menubar-h, 38px);
  left: var(--bimtraza-shell-width, 148px);
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background:
    radial-gradient(1200px 420px at 100% -10%, rgba(47, 110, 163, 0.16), transparent 55%),
    linear-gradient(180deg, #f4f7fb 0%, #e7eef6 100%);
  color: #0f2744;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#bimtraza-agenda.bt-ag[hidden] {
  display: none !important;
}

.bt-ag-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  border-bottom: 1px solid #c9d7e6;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.bt-ag-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 148px;
}

.bt-ag-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #2f6ea3 0%, #1e4f7a 100%);
  color: #f8fbff;
  box-shadow: 0 2px 6px rgba(22, 58, 92, 0.28);
}

.bt-ag-mark svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bt-ag-brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.bt-ag-brand p {
  margin: 2px 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5c6f86;
}

.bt-ag-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bt-ag-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bt-ag-views {
  display: flex;
  padding: 3px;
  border-radius: 10px;
  background: #e7eef6;
  border: 1px solid #c9d7e6;
}

.bt-ag-views button {
  border: 0;
  background: transparent;
  color: #3d5270;
  font: 600 0.78rem/1 "Segoe UI", system-ui, sans-serif;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.bt-ag-views button.is-on {
  background: #ffffff;
  color: #1e4f7a;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.12);
}

.bt-ag-search {
  width: 190px;
  height: 34px;
  border: 1px solid #c9d7e6;
  border-radius: 9px;
  padding: 0 10px;
  background: #fff;
  color: #0f2744;
  font: 500 0.82rem/1 "Segoe UI", system-ui, sans-serif;
}

.bt-ag-search:focus {
  outline: 2px solid rgba(47, 110, 163, 0.35);
  border-color: #2f6ea3;
}

.bt-ag-btn {
  height: 34px;
  border-radius: 9px;
  border: 1px solid #c9d7e6;
  background: #fff;
  color: #1e3a5f;
  font: 650 0.8rem/1 "Segoe UI", system-ui, sans-serif;
  padding: 0 12px;
  cursor: pointer;
}

.bt-ag-btn:hover {
  background: #f3f7fb;
  border-color: #8ca3bf;
}

.bt-ag-btn--primary {
  background: linear-gradient(180deg, #2f6ea3 0%, #1e4f7a 100%);
  border-color: #163a5c;
  color: #f8fbff;
}

.bt-ag-btn--primary:hover {
  background: linear-gradient(180deg, #3a7eb8 0%, #245a8a 100%);
  color: #fff;
}

.bt-ag-btn--ghost {
  width: 34px;
  padding: 0;
  font-size: 1.1rem;
}

.bt-ag-btn--danger {
  background: #fff5f5;
  border-color: #e7b4b4;
  color: #9f1239;
}

.bt-ag-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
}

.bt-ag-side {
  min-height: 0;
  overflow: auto;
  padding: 14px 12px 16px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid #d5e1ee;
}

.bt-ag-card {
  background: #fff;
  border: 1px solid #d5e1ee;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.04);
  padding: 12px;
  margin-bottom: 12px;
}

.bt-ag-card h2 {
  margin: 0 0 8px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5c6f86;
}

.bt-ag-mini {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.bt-ag-mini .dow,
.bt-ag-mini button {
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font: 600 0.72rem/26px "Segoe UI", system-ui, sans-serif;
  color: #3d5270;
  padding: 0;
}

.bt-ag-mini .dow {
  color: #8aa0b8;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.bt-ag-mini button {
  cursor: pointer;
}

.bt-ag-mini button:hover {
  background: #e7eef6;
}

.bt-ag-mini button.is-out {
  color: #b7c6d6;
}

.bt-ag-mini button.is-today {
  box-shadow: inset 0 0 0 1.5px #1e4f7a;
  color: #1e4f7a;
}

.bt-ag-mini button.is-sel {
  background: #1e4f7a;
  color: #fff;
}

.bt-ag-mini button.has-ev {
  position: relative;
}

.bt-ag-mini button.has-ev::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: #2f6ea3;
}

.bt-ag-mini button.is-sel.has-ev::after {
  background: #fff;
}

.bt-ag-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 0.82rem;
  cursor: pointer;
}

.bt-ag-filter i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.bt-ag-up {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bt-ag-up button {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 8px;
  align-items: start;
  width: 100%;
  text-align: left;
  border: 0;
  background: #f7fafc;
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
  font: 600 0.75rem/1.3 "Segoe UI", system-ui, sans-serif;
  color: #0f2744;
}

.bt-ag-up button span {
  display: block;
  font-weight: 500;
  color: #5c6f86;
}

.bt-ag-up i {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 2px;
}

.bt-ag-empty {
  margin: 0;
  color: #5c6f86;
  font-size: 0.78rem;
  line-height: 1.4;
}

.bt-ag-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bt-ag-side-actions .bt-ag-btn {
  flex: 1 1 auto;
  height: 30px;
  font-size: 0.72rem;
}

.bt-ag-side-actions .bt-ag-btn--crono {
  flex: 1 1 100%;
  height: auto;
  min-height: 32px;
  padding: 6px 8px;
  line-height: 1.25;
  white-space: normal;
  background: linear-gradient(180deg, #2f6ea3 0%, #1e4f7a 100%);
  border-color: #163a5c;
  color: #f8fbff;
}

.bt-ag-side-actions .bt-ag-btn--crono:hover {
  background: linear-gradient(180deg, #3a7eb8 0%, #245a8a 100%);
  color: #fff;
}

.bt-ag-crono {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 39, 68, 0.35);
  padding: 24px;
}

#bimtraza-agenda .bt-ag-crono[hidden] {
  display: none !important;
}

.bt-ag-crono-card {
  width: min(420px, 100%);
  box-sizing: border-box;
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #d5e1ee;
  box-shadow: 0 16px 40px rgba(15, 39, 68, 0.18);
}

.bt-ag-crono-card h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.bt-ag-crono-card p {
  margin: 0 0 14px;
  color: #5c6f86;
  font-size: 0.8rem;
  line-height: 1.4;
}

.bt-ag-crono-opt {
  display: block;
  width: 100%;
  height: auto;
  min-height: 38px;
  margin-bottom: 8px;
  text-align: left;
  padding: 8px 12px;
}

.bt-ag-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.bt-ag-year {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  align-content: start;
  gap: 10px;
  overflow: auto;
}

.bt-ag-ym {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #d5e1ee;
  border-radius: 12px;
  padding: 10px 10px 8px;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.04);
}

.bt-ag-ym-title {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0 2px 4px;
  cursor: pointer;
  font: 700 1.02rem/1.2 "Segoe UI", system-ui, sans-serif;
  color: #1e4f7a;
  text-transform: capitalize;
}

.bt-ag-ym-title:hover {
  color: #163e73;
}

.bt-ag-ym-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  text-align: center;
}

.bt-ag-ym-grid span {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #8aa0b8;
  line-height: 1.4;
}

.bt-ag-yday {
  border: 0;
  background: transparent;
  border-radius: 6px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  font: 600 0.9rem/24px "Segoe UI", system-ui, sans-serif;
  color: #1e3a5f;
}

.bt-ag-yday:hover {
  background: #e7eef6;
}

.bt-ag-yday.is-out {
  color: #d5e1ee;
}

.bt-ag-yday.is-today {
  box-shadow: inset 0 0 0 1.5px #1e4f7a;
  color: #1e4f7a;
}

.bt-ag-yday.is-sel {
  background: #1e4f7a;
  color: #fff;
}

.bt-ag-yday.has-ev {
  position: relative;
  font-weight: 800;
}

.bt-ag-yday.has-ev::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 3px;
  height: 3px;
  margin-left: -1.5px;
  border-radius: 50%;
  background: #c2410c;
}

.bt-ag-yday.is-sel.has-ev::after {
  background: #fff;
}

@media (max-width: 1100px) {
  .bt-ag-year {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.bt-ag-month,
.bt-ag-list,
.bt-ag-daywrap,
.bt-ag-week {
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
  border: 1px solid #d5e1ee;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(15, 39, 68, 0.05);
  overflow: hidden;
}

.bt-ag-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f7fafc;
  border-bottom: 1px solid #000;
}

.bt-ag-dow span {
  padding: 8px 8px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: #5c6f86;
}

.bt-ag-month-grid {
  height: calc(100% - 32px);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 0;
  background: #fff;
}

.bt-ag-day {
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  border: 0;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  cursor: pointer;
}

.bt-ag-day:nth-child(7n) {
  border-right: 0;
}

.bt-ag-day:nth-child(n + 36) {
  border-bottom: 0;
}

.bt-ag-day.is-out {
  background: #d5dee8;
}

.bt-ag-day.is-out .bt-ag-daynum {
  color: #6d8298;
}

.bt-ag-day.is-sel {
  background: #f3f8fd;
  box-shadow: inset 0 0 0 1px #c5daf0;
}

.bt-ag-day.is-today .bt-ag-daynum {
  background: #1e4f7a;
  color: #fff;
}

.bt-ag-daynum {
  align-self: flex-end;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  text-align: center;
  font: 700 0.75rem/22px "Segoe UI", system-ui, sans-serif;
  color: #1e3a5f;
}

.bt-ag-chip,
.bt-ag-more {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 5px;
  padding: 2px 6px 2px 7px;
  text-align: left;
  font: 650 0.68rem/1.35 "Segoe UI", system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.bt-ag-more {
  background: transparent;
  color: #1e4f7a;
}

.bt-ag-week,
.bt-ag-daywrap {
  display: flex;
  flex-direction: column;
}

.bt-ag-cols,
.bt-ag-allday {
  padding-right: var(--ag-sb, 0px);
  box-sizing: border-box;
}

.bt-ag-cols {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid #000;
  background: #f7fafc;
}

.bt-ag-daywrap .bt-ag-cols {
  grid-template-columns: 56px minmax(0, 1fr);
}

.bt-ag-cols > button,
.bt-ag-cols > div,
.bt-ag-allday > .lbl,
.bt-ag-allday > .cell {
  border: 0;
  box-sizing: border-box;
  background: transparent;
  padding: 8px 6px;
  text-align: left;
  cursor: pointer;
  font: 650 0.75rem/1.25 "Segoe UI", system-ui, sans-serif;
  color: #1e3a5f;
  min-width: 0;
}

.bt-ag-cols > button,
.bt-ag-allday > .cell {
  border-left: 0.5px solid #000;
}

.bt-ag-cols button small,
.bt-ag-allday small {
  display: block;
  font-weight: 700;
  color: #5c6f86;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.bt-ag-cols button.is-today {
  background: #eaf3fb;
  color: #1e4f7a;
}

.bt-ag-allday {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  min-height: 36px;
  border-bottom: 1px solid #000;
}

.bt-ag-daywrap .bt-ag-allday {
  grid-template-columns: 56px minmax(0, 1fr);
}

.bt-ag-allday .lbl {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8aa0b8;
  padding: 8px 4px;
  text-align: right;
}

.bt-ag-allday .cell {
  padding: 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bt-ag-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.bt-ag-timegrid {
  position: relative;
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
}

.bt-ag-daywrap .bt-ag-timegrid {
  grid-template-columns: 56px minmax(0, 1fr);
}

.bt-ag-hours {
  position: relative;
}

.bt-ag-hours span {
  display: block;
  height: 48px;
  box-sizing: border-box;
  padding: 0 6px 0 0;
  text-align: right;
  font-size: 0.65rem;
  color: #000;
  transform: translateY(-6px);
}

.bt-ag-col {
  position: relative;
  border-left: 0.5px solid #000;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(48px - 0.5px),
    #000 calc(48px - 0.5px),
    #000 48px
  );
  min-height: calc(24 * 48px);
}

.bt-ag-slot {
  position: absolute;
  left: 0;
  right: 0;
  height: 48px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.bt-ag-slot:hover {
  background: #e7f5fc;
}

.bt-ag-block {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  border: 0;
  border-radius: 7px;
  padding: 4px 6px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  font: 650 0.72rem/1.25 "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.08);
}

.bt-ag-block small {
  display: block;
  font-weight: 500;
  opacity: 0.85;
}

.bt-ag-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #b91c1c;
  z-index: 2;
  pointer-events: none;
}

.bt-ag-now::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b91c1c;
}

.bt-ag-list {
  overflow: auto;
  padding: 8px 0 16px;
}

.bt-ag-list h3 {
  margin: 14px 18px 6px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5c6f86;
}

.bt-ag-list article {
  display: grid;
  grid-template-columns: 92px 8px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 0 12px 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #e7f5fc;
  cursor: pointer;
  border: 1px solid transparent;
}

.bt-ag-list article:hover {
  border-color: #b7e0c4;
  background: #e7f8ec;
}

.bt-ag-list time {
  font: 700 0.78rem/1.3 "Segoe UI", system-ui, sans-serif;
  color: #1e4f7a;
}

.bt-ag-list strong {
  display: block;
  font-size: 0.9rem;
}

.bt-ag-list em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 0.75rem;
  color: #5c6f86;
}

.bt-ag-editor {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 39, 68, 0.28);
}

#bimtraza-agenda .bt-ag-editor[hidden] {
  display: none !important;
}

.bt-ag-panel {
  width: min(420px, 100%);
  height: 100%;
  overflow: auto;
  box-sizing: border-box;
  padding: 18px 18px 24px;
  background: #fff;
  box-shadow: -12px 0 32px rgba(15, 39, 68, 0.12);
}

.bt-ag-panel h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.bt-ag-panel .hint {
  margin: 0 0 14px;
  color: #5c6f86;
  font-size: 0.78rem;
}

.bt-ag-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #3d5270;
}

.bt-ag-field input,
.bt-ag-field select,
.bt-ag-field textarea {
  border: 1px solid #c9d7e6;
  border-radius: 9px;
  padding: 8px 10px;
  font: 500 0.86rem/1.3 "Segoe UI", system-ui, sans-serif;
  color: #0f2744;
  background: #fff;
}

.bt-ag-field textarea {
  min-height: 88px;
  resize: vertical;
}

.bt-ag-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bt-ag-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.bt-ag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.bt-ag-err {
  min-height: 1.1em;
  margin: 0 0 8px;
  color: #9f1239;
  font-size: 0.78rem;
}

.bt-ag-toast {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0f2744;
  color: #f8fbff;
  box-shadow: 0 10px 24px rgba(15, 39, 68, 0.28);
  font-size: 0.82rem;
  line-height: 1.35;
}

.bt-ag-toast[hidden] {
  display: none !important;
}

.bt-ag-toast strong {
  display: block;
  margin-bottom: 2px;
}

@media (max-width: 980px) {
  .bt-ag-body {
    grid-template-columns: 1fr;
  }
  .bt-ag-side {
    display: none;
  }
  .bt-ag-search {
    width: 120px;
  }
}
