.planilla {
  padding: 28px 0 24px;
}

.planilla-intro,
.planilla-regla,
.planilla-edificio,
.planilla-comparativa,
.planilla-desglose,
.puesto,
.planilla-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 22px;
}

.planilla-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 32px 36px;
}

.planilla-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f3ecdf;
  color: var(--brand-gold-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.planilla-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-gold);
}

.planilla-intro h1 {
  max-width: 16ch;
  margin: 0 0 14px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.05;
}

.planilla-intro p {
  max-width: 62ch;
  margin: 0;
  color: var(--color-muted);
}

.planilla-intro-btn {
  flex: 0 0 auto;
  max-width: 280px;
  min-height: 64px;
  padding: 14px 18px;
  border-radius: 16px;
  text-align: left;
  line-height: 1.3;
}

.planilla-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 28px 0 18px;
}

.planilla-head h2,
.planilla-col-head h3,
.planilla-edificio h3,
.planilla-comparativa h3,
.planilla-desglose h3 {
  margin: 0 0 6px;
}

.planilla-head p,
.planilla-col-head p,
.planilla-regla p,
.planilla-edificio-head p {
  margin: 0;
  color: var(--color-muted);
}

.planilla-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.planilla-reglas {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin-bottom: 22px;
}

.planilla-regla {
  padding: 18px 20px;
}

.planilla-regla legend,
.planilla-regla-titulo {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
}

.planilla-segmento {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.planilla-segmento button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: transparent;
  color: var(--color-ink);
  font: 700 14px/1 var(--font-body);
  cursor: pointer;
}

.planilla-segmento button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--brand-gold);
}

.planilla-nota,
.planilla-af-estado {
  margin-top: 12px !important;
  font-size: 14px;
}

.planilla-regla-af {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.planilla-switch {
  position: relative;
  flex: 0 0 auto;
}

.planilla-switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.planilla-switch-ui {
  display: block;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #ddd6cb;
  transition: background 0.2s ease;
}

.planilla-switch-ui::after {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  margin: 3px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
}

.planilla-switch input:checked + .planilla-switch-ui {
  background: var(--brand-gold);
}

.planilla-switch input:checked + .planilla-switch-ui::after {
  transform: translateX(22px);
}

.planilla-switch input:focus-visible + .planilla-switch-ui {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

.planilla-trabajo {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  gap: 22px;
  align-items: start;
}

.planilla-col-head,
.planilla-edificio-head,
.planilla-comparativa-head,
.planilla-desglose-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.planilla-col-head h3,
.planilla-comparativa h3,
.planilla-desglose h3 {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.planilla-perfiles {
  display: grid;
  gap: 12px;
}

.puesto {
  padding: 16px 16px 14px;
  cursor: grab;
}

.puesto:active {
  cursor: grabbing;
}

.puesto.is-dragging {
  opacity: 0.55;
}

.puesto-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.puesto-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.puesto-avatar svg {
  width: 22px;
  height: 22px;
}

.puesto[data-tone="admin"] .puesto-avatar { background: #efe8dc; color: #6d5b3e; }
.puesto[data-tone="day"] .puesto-avatar { background: #e7eef8; color: #2d4f86; }
.puesto[data-tone="night"] .puesto-avatar { background: #2c2c2c; color: #f4efe6; }
.puesto[data-tone="relief"] .puesto-avatar { background: #f4e7d4; color: #8a5a22; }
.puesto[data-tone="clean"] .puesto-avatar { background: #e5f0e8; color: #2f6a45; }

.puesto h3 {
  margin: 0;
  font-size: 16px;
}

.puesto .horario {
  margin: 2px 0 0;
  color: var(--color-muted);
  font-size: 13px;
}

.puesto-desglose {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-gold-deep);
  font: 600 13px/1.4 var(--font-body);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.puesto-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.puesto-costo-label {
  display: block;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.puesto-costo {
  font-family: var(--font-heading);
  font-size: 28px;
  line-height: 1.1;
}

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

.stepper-qty {
  min-width: 1.2ch;
  font-weight: 700;
  text-align: center;
}

.stepper button {
  min-height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.stepper [data-step="-1"] {
  width: 36px;
  border: 1px solid var(--color-border);
  background: white;
}

.stepper [data-step="1"] {
  padding: 0 12px;
  border: 0;
  background: var(--brand-gold);
  color: var(--color-ink);
}

.planilla-edificio,
.planilla-comparativa,
.planilla-desglose {
  padding: 18px;
  margin-bottom: 14px;
}

.planilla-dotacion {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  text-align: right;
  font-size: 13px;
}

.planilla-dotacion strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 22px;
  line-height: 1;
}

.planilla-drop {
  min-height: 230px;
  padding: 18px;
  border: 1.5px dashed #d9d0c2;
  border-radius: 18px;
  background: #fcfbf8;
}

.planilla-drop.is-over {
  border-color: var(--brand-gold-deep);
  background: #f8f1e4;
}

.planilla-vacio {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 28px 12px;
  color: var(--color-muted);
}

.planilla-vacio p {
  margin: 0;
  max-width: 46ch;
}

.planilla-vacio strong {
  display: block;
  margin-bottom: 6px;
  color: var(--color-ink);
}

.planilla-vacio-mas {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: #f3ecdf;
  color: var(--brand-gold-deep);
  font-size: 32px;
  line-height: 1;
}

.planilla-asignados {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.asignado {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--color-border);
}

.asignado strong {
  display: block;
}

.asignado span {
  color: var(--color-muted);
  font-size: 13px;
}

.planilla-comparativa-head p,
.planilla-desglose-head .planilla-chip {
  margin: 0;
  color: var(--brand-gold-deep);
  font-size: 13px;
  font-weight: 700;
}

.planilla-comparativa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.planilla-regimen {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #fcfbf8;
}

.planilla-regimen.is-activo {
  border-color: #ead9b0;
  background: #fffaf1;
}

.planilla-regimen header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.planilla-regimen h4 {
  margin: 0;
  font-size: 15px;
}

.planilla-activo {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.planilla-monto {
  margin: 10px 0 0;
  font-family: var(--font-heading);
  font-size: 32px;
  line-height: 1;
}

.planilla-regimen p:last-child {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 14px;
}

.planilla-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3ecdf;
}

.planilla-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.planilla-tabla th {
  padding: 8px 6px 10px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

.planilla-tabla th:first-child,
.planilla-tabla td:first-child {
  text-align: left;
}

.planilla-tabla td {
  padding: 10px 6px;
  border-bottom: 1px solid #f0ebe3;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.planilla-tabla-vacio {
  margin: 8px 0 0;
  color: var(--color-muted);
  text-align: center;
}

.planilla-total {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: 22px;
  background: var(--color-ink);
  color: #f7f4ed;
}

.planilla-total-cifras {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.planilla-total p {
  margin: 0 0 6px;
  color: #d9d0c2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.planilla-total strong {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

.planilla-total strong span {
  font-size: 16px;
  font-weight: 600;
}

.planilla-total-acciones {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.planilla-disclaimer {
  max-width: 46ch;
  margin: 0 !important;
  color: #cfc6b8 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.planilla-btn-luz {
  margin-left: 8px;
  background: transparent;
  color: #f7f4ed;
  border-color: rgba(247, 244, 237, 0.4);
}

.planilla-copiado {
  min-height: 1.2em;
  margin: 8px 0 0 !important;
  color: var(--brand-gold-light) !important;
  font-size: 13px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.planilla-dialog {
  width: min(640px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  color: var(--color-ink);
}

.planilla-dialog::backdrop {
  background: rgba(21, 21, 21, 0.46);
}

.planilla-dialog form {
  padding: 22px;
}

.planilla-dialog header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.planilla-dialog h2 {
  margin: 0 0 4px;
  font-size: 28px;
}

.planilla-dialog header p:last-child,
.planilla-dialog [data-dialog-detalle] {
  color: var(--color-muted);
}

.planilla-cerrar {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f3ecdf;
  font-size: 22px;
  cursor: pointer;
}

.planilla-dialog table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
}

.planilla-dialog th,
.planilla-dialog td {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.planilla-dialog td,
.planilla-dialog tfoot th,
.planilla-dialog tfoot td {
  text-align: right;
}

.planilla-dialog tfoot th {
  text-align: left;
}

@media (max-width: 980px) {
  .planilla-intro,
  .planilla-head,
  .planilla-reglas,
  .planilla-trabajo,
  .planilla-comparativa-grid,
  .planilla-total-cifras,
  .planilla-total-acciones,
  .asignado {
    grid-template-columns: 1fr;
    display: grid;
  }

  .planilla-intro,
  .planilla-head,
  .planilla-regla-af,
  .planilla-total-acciones {
    align-items: stretch;
  }

  .planilla-intro h1,
  .planilla-intro-btn {
    max-width: none;
  }

  .planilla-head-actions,
  .planilla-head-actions .btn {
    width: 100%;
  }
}
