:root {
  --card-bg: #fff;
  --muted: #666;
  --shadow: 0 4px 14px rgba(10,10,10,0.06);
  font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  background: #f4f6f9;
  color: #111;
}

.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 18px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.controls {
  display: flex;
  gap: 8px;
}

.controls select,
.controls button {
  padding: 6px 10px;
}

/* calendario */
#calendarArea {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.month {
  background: var(--card-bg);
  padding: 8px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.month h3 {
  text-align: center;
  margin: 0 0 6px;
}

.weekdays,
.dates-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
  font-size: 0.85rem;
}

.weekdays div {
  font-weight: 600;
  color: var(--muted);
}

/* Las horas semanales quedan dentro del propio recuadro blanco.
   Se reserva una columna lateral sin convertirla en una octava
   columna del calendario de días. */
.calendar-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  column-gap: 5px;
  width: 100%;
  box-sizing: border-box;
  align-items: start;
}

.calendar-days {
  min-width: 0;
}

.week-hours-column {
  display: grid;
  grid-auto-rows: 36px;
  row-gap: 6px;
  padding-top: 20px;
  align-items: center;
  min-width: 0;
}

.week-hours {
  width: 34px;
  box-sizing: border-box;
  font-size: 0.52rem;
  line-height: 1;
  color: #777;
  white-space: nowrap;
  text-align: left;
  pointer-events: none;
}

/* celda de cada día */
.date-cell {
  height: 36px;
  line-height: 36px;
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
}

.date-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.date-empty {
  background: transparent;
  cursor: default;
}

.date-num {
  font-size: 0.8rem;
}

.month-total {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dashed #ccc;
  text-align: right;
  font-size: 0.9rem;
}

/* jornadas */
.schedule-section {
  margin: 16px 0;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 8px;
  margin-bottom: 16px;
}

.schedule-table th,
.schedule-table td {
  padding: 6px;
  border: 1px solid #eee;
  text-align: center;
  font-size: 0.9rem;
}

.schedule-table input {
  width: 60px;
  text-align: center;
}

/* leyenda */
.legend-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.tool {
  padding: 6px 10px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tool.active {
  background: #ffd;
}

.tool:hover {
  background: #e6f0ff;
  border-color: #99c2ff;
}

.legend-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.legend-table th,
.legend-table td {
  padding: 6px;
  border-bottom: 1px solid #eee;
  text-align: center;
  vertical-align: middle;
}

.legend-table tr.selected {
  background-color: rgba(0, 0, 0, 0.05);
}

.legend-table tr.copied {
  background-color: rgba(40, 150, 255, 0.1);
}

.legend-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.small-btn {
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.small-btn:hover {
  background: #f0f8ff;
  border-color: #99c2ff;
}

.delete-btn {
  background: #fee;
  border-color: #f99;
}

.delete-btn:hover {
  background: #ffcccc;
  border-color: #e60000;
}

.legend-table input[type="text"] {
  min-width: 260px;
}

.legend-table input[type="number"] {
  width: 45px;
  text-align: center;
}

#brushCopyBtn {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

#brushCopyBtn.active {
  background: #ffe58f;
  border-color: #d4b106;
}

#brushCopyBtn img {
  transition: filter 0.2s ease;
}

#brushCopyBtn:hover img {
  filter: hue-rotate(200deg) brightness(1.2);
}

/* resumen */
.summary-wrapper {
  overflow: auto;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 8px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table th,
.summary-table td {
  border: 1px solid #e9eef6;
  padding: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.summary-table th {
  background: #f0f4fb;
}

.summary-table tfoot td {
  background: #fafafa;
  text-align: center;
  font-weight: bold;
  font-size: 1rem;
}

.color-box {
  width: 28px;
  height: 20px;
  border: 1px solid #ccc;
  display: inline-block;
  border-radius: 4px;
}
